fix: keep sidebar file changes live while window is visible#1341
Merged
rabanspiegel merged 2 commits intomainfrom Mar 6, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR widens the condition under which the sidebar polls for file changes: previously refreshes were gated on the window having keyboard focus ( Key changes:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/renderer/hooks/useFileChanges.ts | Removes the isWindowFocused state and its focus/blur event listeners; replaces the inline shouldPoll expression with an exported shouldRefreshFileChanges helper; replaces (window as any) casts with a properly-typed IdleCallbackWindow intersection type. Logic is clean and correct. |
| src/test/renderer/useFileChanges.test.ts | New unit tests for shouldRefreshFileChanges; covers the main gate conditions (missing path, inactive, hidden document) but contains a duplicate test case whose description misleadingly implies focus-related coverage. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[shouldRefreshFileChanges called] --> B{taskPath defined?}
B -- No --> Z[return false — no polling]
B -- Yes --> C{isActive?}
C -- No --> Z
C -- Yes --> D{isDocumentVisible?}
D -- No --> Z
D -- Yes --> E[return true — poll / refresh]
subgraph Before PR
F[also required isWindowFocused via focus/blur events]
end
subgraph After PR
G[window focus no longer gated — document visibility is sufficient]
end
E -.->|was also blocked by| F
E -.->|now uses| G
Last reviewed commit: 838668e
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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
Testing
Note
Low Risk
Adjusts file-change polling gating logic, which could slightly increase refresh activity when the window is visible but unfocused; behavior remains paused when the document is hidden.
Overview
Keeps sidebar file-change refreshes running whenever a task is active and the document is visible, removing the prior requirement that the window be focused.
Extracts the polling gate into
shouldRefreshFileChanges(and adds a small Vitest unit test for it), and tightens typing aroundrequestIdleCallback/cancelIdleCallbackusage inuseFileChanges.Written by Cursor Bugbot for commit b7abd4d. This will update automatically on new commits. Configure here.