Skip to content

Commit 41c1860

Browse files
committed
Bugfix: Network pane stuck on old host after mount success
- `NetworkMountView.handleShareSelect` cleared its local `currentNetworkHost` after a successful mount but didn't propagate the null via `onNetworkHostChange`. The parent `FilePane` kept the stale host in its own `$state`, so the next time the user switched back to Network (for example, in a subsequent test), `NetworkMountView` was re-mounted with `initialNetworkHost = <old host>` and rendered `ShareBrowser` for the old host instead of the host list. In E2E, `move_cursor("SMB Test (Unicode)")` then had no effect (ShareBrowser has no such share) and `open_under_cursor` opened the wrong entry. Add `onNetworkHostChange(null)` so the parent stays in sync. - `ShareBrowser.loadShares` also now retries for cached non-auth errors (`host_unreachable`, `timeout`, ...) instead of rendering the cached error directly. User-initiated host open is an implicit "try again" — the initial background prefetch may have run before the host was ready. - Fixes `smb.spec.ts:436` "unicode shares render correctly" when run in the full suite.
1 parent c26f7e8 commit 41c1860

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

apps/desktop/src/lib/file-explorer/network/ShareBrowser.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,13 @@
170170
}
171171
// No stored credentials, show login form
172172
showLoginForm = true
173+
error = cachedState.error
174+
loading = false
175+
return
173176
}
174-
// No stored credentials or they didn't work
175-
error = cachedState.error
176-
loading = false
177-
return
177+
// Non-auth error (host_unreachable, timeout, etc.): the user is
178+
// explicitly opening the host, so retry. The initial background
179+
// prefetch may have run before the host was ready.
178180
}
179181
180182
// Fetch shares

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@
121121
)
122122
123123
// Navigate to the mounted share
124-
// Clear current network host first
124+
// Clear current network host first (also propagate up so the parent
125+
// pane's state doesn't hold onto a stale host; otherwise the next
126+
// time the user switches back to Network, ShareBrowser for the old
127+
// host would render instead of the NetworkBrowser list).
125128
currentNetworkHost = null
126129
lastMountAttempt = null
130+
onNetworkHostChange?.(null)
127131
128132
// The mount path is typically /Volumes/<ShareName>
129133
const mountPath = result.mountPath

0 commit comments

Comments
 (0)