fix: refresh history and PR state after off-tab watcher ref changes - #26
Merged
Merged
Conversation
Commits made while the History tab was inactive (e.g. by an agent) did not appear until an unrelated later watcher event. handleRepoChanged only reloaded history when view === 'history', setView reloaded only when the list was empty, and window.focus refreshes status only. Track a stale flag on HistoryState: set it when refs change off-tab, consume it on History tab entry, and clear it on a reset load (preserving a flag re-raised mid-request and never clearing on paginated append).
The View Pull Request command read a cached prs.current that was only populated on repo open, push/checkout/PR actions in-app, and a 3-minute background poll. A PR created outside gitgood was invisible until that poll ticked, so the command could report "No pull request for this branch" despite an open PR. fetchRemote() and pull() now force-refresh the current PR, so an explicit remote sync surfaces an externally-created (or merged/closed) PR immediately, without checking on every local commit.
erwin-wee
force-pushed
the
fix/history-stale-refresh
branch
from
September 22, 2026 10:28
85a5910 to
fcf49ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related fixes: watcher-detected ref changes did not refresh derived UI state, so state updated by an agent or from a terminal appeared stale.
1. History tab did not reload after off-tab commits
Commits made while the History tab was inactive (e.g. by a background agent) did not appear until an unrelated later watcher event.
handleRepoChangedreloaded history only whenview === 'history'.setView('history')reloaded only when the list was empty.window.focusrefreshes status only.Fix: a
staleflag onHistoryState— set on off-tab ref changes, consumed on History tab entry, cleared on a reset load (preserving a flag re-raised mid-request; never cleared on paginated append).2. "View Pull Request" reported no PR after an external PR
view-pull-requestreads cachedprs.current, populated only on repo open, in-app push/checkout/PR actions, and a 3-minute background poll. A PR created outside gitgood was invisible until that poll ticked, so the command could say "No pull request for this branch" despite an open PR.Fix:
fetchRemote()andpull()now force-refresh the current PR. An explicit remote sync surfaces an externally-created (or merged/closed) PR immediately, without checking on every local commit. In-app branch switches already refresh it (checkoutBranch), and the 3-minute poll still covers passive discovery.Notes
loadHistoryexpression.npm run typecheckpasses.