fix(clients): refresh project folders when reopened - #5367
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved 4646f2c Straightforward bug fix adding a You can customize Macroscope's approvability policy. Learn more. |
Problem
The Add Project folder browser retained directory results for 30 seconds. If a user closed the picker, cloned a repository in a terminal, and reopened the picker during that window, the new folder was missing until the cache expired or T3 Code restarted.
Fix
Before / after
Both captures reopen the picker within the old 30-second freshness window after a real external
git clone.Testing
vp test run packages/client-runtime/src/state/runtime.test.ts packages/client-runtime/src/state/filesystem.test.ts— 24 tests passedmain2.3 seconds aftergit cloneModel: GPT-5.6; harness: Codex in T3 Code.
Note
Low Risk
Targeted query-cache refresh for filesystem browse only; existing SWR caching remains the default elsewhere.
Overview
Fixes stale Add Project folder listings when the picker is reopened while cached directory results are still fresh (e.g. after an external
git clone).Runtime: Adds opt-in
refreshonAtomQueryOptions/executeAtomQuery, which callsregistry.refresh(atom)before reading so retained queries can re-fetch even inside the SWR stale window. A unit test covers refresh vs cached reads.Web & mobile: Filesystem browse preloads via
useAtomQueryRunnernow passrefresh: true, so opening or navigating the Add Project picker forces a directory re-read. On mobile,FolderBrowseralso callsbrowseState.refresh()on mount when a completed cached listing is already present, without disturbing in-flight loads.Short-lived cache behavior for rendering and back navigation is unchanged.
Reviewed by Cursor Bugbot for commit 4646f2c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Refresh project folder contents when reopening the browse dialog
refreshoption toexecuteAtomQueryin runtime.ts that callsregistry.refresh(atom)before reading, returning up-to-date data even when the cache is fresh.useAtomQueryRunner(web and mobile) to accept and forward therefreshflag, and passesrefresh: truewhen loading browse paths in the Command Palette and Add Project screen.FolderBrowserin AddProjectScreen.tsx triggers a refresh if a non-pending cached value exists, ensuring stale directory listings are re-fetched.Macroscope summarized 4646f2c.