fix: Refresh Review tab diffs on window focus to catch external edits - #197
Merged
Conversation
The Review tab only re-fetched file content on the "workspace-files-changed" event, which the native file watcher never actually emits (its startup call in Dashboard.tsx has been commented out). An already-modified file that gets edited further also doesn't change jj's reported status, so even a plain file-list refresh wouldn't reveal the new content. Re-fetch the file list and hunks for the open files whenever the window regains focus (via Tauri's onFocusChanged), so switching back to the app always shows current disk content. Adds scripts/screenshot/specs/review-tab-refocus-refresh.spec.tsx to verify.
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.
Summary
This PR adds logic to refresh the Review tab's diff content whenever the application window regains focus. This ensures that file edits made while the window was unfocused are reflected in the UI, even when those edits don't trigger file watcher events (e.g., when editing an already-modified file).
Key Changes
getCurrentWindow().onFocusChanged()to detect focus eventsloadChangedFiles()andloadAllFileHunks()to refresh the diff viewreview-tab-refocus-refresh.spec.tsx) that verifies:Implementation Details
loadChangedFiles,loadAllFileHunks, andfilesto avoid stale closuresworkspaceIddependency)onFocusChanged()registration with proper cleanup logicpayload: true), not when it loses focushttps://claude.ai/code/session_018Py2TEY7RzxTcMNYUmL19W