Repository navigation
Reset explorer files when switching remote hosts at the same path - #26627
Conversation
c06c5fb to
d097934
Compare
e4d139a to
a4d4c9f
Compare
d097934 to
e0d99fa
Compare
a4d4c9f to
40378b3
Compare
e0d99fa to
53d0e31
Compare
804f466 to
3d577f3
Compare
53d0e31 to
0f6dfc4
Compare
3d577f3 to
4b49611
Compare
16eb5c0 to
0bb7200
Compare
27abb81 to
8085a9e
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe explorer subtree is now keyed by the active worktree’s operation owner. Tree cleanup resets its directory-load tracker and invalidates pending refreshes. New lifecycle tests cover unmounts, StrictMode, and sidebar reopening. The selected-host E2E test now checks nested files across host switches and sidebar reopening. E2E routing and its test include explorer source changes. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The explorer changes and their selected-host test routing show no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)✅ Passed checks (3 passed)Full details: Description checkExplanation The description is detailed and covers the change, rationale, testing, visual proof, compatibility notes, and checklist. However, the required Linked Issue section does not contain an actual issue link and instead states that no issue exists.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
ELI5
Two remote machines can have the same folder ID and path. Switching machines now replaces the explorer's cached tree, so you see the selected machine's files.
What Changed
Before, clicking the other host's folder changed the active host and successful file reads, but Files kept the previous host's root and expanded directory contents. The existing reset checked only the absolute path.
The explorer now keys its existing component by the canonical operation owner. A host change replaces its cache, selection and watch lifetime. Retirement invalidates pending directory reads through the existing generation and load tokens, and initial loading handles React StrictMode replay. Hiding and reopening Files on the same host preserves its tree.
Why
Ownership already has a shared resolver. Using its identity for the component lifetime keeps all explorer state together, rather than adding separate host-reset rules to each cache and interaction hook. Existing path resets still handle workspace changes on the same host.
Linked Issue
Found during SSH → Remote consolidation testing; no existing issue.
Visual Proof
Two valid, independently converted Linux SSH hosts publish the same folder ID and path. The identical baseline switches host successfully and reads the new host's sentinel, but retains the old root and nested listing. Corrected runs display the new host's root and expanded nested files in both directions.
explorer-host-cache-runtime-red-final.log
explorer-host-cache-runtime-green-final.log
Testing
Untouched parent baseline fails both switch directions in 29.5 / 29.4 s. Fresh corrected runs pass in 19.7 / 19.8 s (41.6 s total), including selected-host creation/deletion, actual sidebar switches, already-expanded nested directories, switching back, and hide/reopen.
The two new retirement regressions fail before the fix; StrictMode and hide/reopen controls already pass. All 230 tests / 19 files pass afterward. Full
pnpm tc,pnpm lint, changed quality, standalone React Doctor, fresh E2E build and commit hooks pass.Combined stack verification: C18–C21 rebased on #26637/#26645 preserves their renderer changes exactly. 547 tests / 49 files, full typecheck/lint, changed quality (including React Doctor/design-system checks), a fresh E2E build and both real-host switch directions pass. CI reruns on the new head; prior green results are not claimed for it.
Review
Stacked on #26616; merge #26637 → #26645 → #26616 first. Its selected-host watcher snapshot fix is required for this journey's creation/deletion controls. This PR isolates equal-path host-switch cache lifetime and cancellation.
Agent skill upstream boundary
Notes
No server or wire change. Runtime coverage is macOS client / Linux SSH hosts; Windows was not exercised. All host writes target disposable fixtures. Shared watcher target selection and sidebar active highlighting are separate investigations.
Checklist