Skip to content

Commit 602fcb9

Browse files
committed
Pane state: clear network host on leaving the network volume
`currentNetworkHost` in FilePane was only reset when the user clicked Back inside ShareBrowser. Volume-switches via the picker / breadcrumb / history nav / MCP left the host pinned: re-entering Network re-mounted NetworkMountView with the stale `initialNetworkHost`, which renders ShareBrowser for that host instead of the host list. In the SMB E2E suite this manifested as a chain: test #4 (`mounting guest share`) opens guest, the next test's beforeEach switches the pane to local, then the test re-selects Network — and lands on ShareBrowser for guest instead of NetworkBrowser. `cmdr://state` then contains the share list of guest's public share, not the 14-host roster, so `state.includes('SMB Test (Guest)') && state.includes('shares=1')` is never true and the spec hits its 30s pollUntil deadline. Fix: a `$effect` in FilePane clears `currentNetworkHost` whenever `isNetworkView` becomes false. Re-entry now always lands on the host list. This matches the gotcha already documented in `file-explorer/network/CLAUDE.md` ('previous test that mounted a guest share left FilePane stuck on guest').
1 parent a1d1994 commit 602fcb9

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

apps/desktop/src/lib/file-explorer/pane/FilePane.svelte

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,24 @@
423423
// Network browsing state - tracked here for history navigation integration
424424
let currentNetworkHost = $state<NetworkHost | null>(null)
425425
426+
// Clear the selected network host whenever the pane leaves the network
427+
// volume so that re-entering Network always lands on the host list, not on
428+
// a stale ShareBrowser for whichever host was open last. Without this,
429+
// `NetworkMountView` re-mounts with the old `initialNetworkHost` and the
430+
// user sees the previous share list when they expected the host list.
431+
//
432+
// Previously this only got cleared by an explicit "Back" click inside
433+
// `ShareBrowser` (which calls `onNetworkHostChange(null)`). Volume-switches
434+
// via the picker, the breadcrumb, history navigation, or MCP didn't trip
435+
// that path, so the host stayed pinned. The matching gotcha in
436+
// `file-explorer/network/CLAUDE.md` documented this as the cause of E2E
437+
// test 436 ("unicode shares render") and several SMB share-count tests.
438+
$effect(() => {
439+
if (!isNetworkView && currentNetworkHost !== null) {
440+
currentNetworkHost = null
441+
}
442+
})
443+
426444
// noinspection JSUnusedGlobalSymbols -- Used dynamically
427445
export function toggleVolumeChooser() {
428446
volumeBreadcrumbRef?.toggle()

0 commit comments

Comments
 (0)