Commit 3f6b1b0
committed
SMB reconnect: Guard handleDirect against double-fire
Both `runAttempt`'s success branch and the `smb-connection-changed` event listener can call `handleDirect` for the same cycle, which would fire `onSuccess` twice and double-trigger `loadDirectory` in the FilePane. The new guard checks the entry's baseline shape (`status: 'waiting'`, no timer, `attemptIndex: 0`) and returns early when there's nothing to clean up. The runAttempt-side call stays as a defensive backstop — `handleDirect` is now safely idempotent.
Adds a regression test that triggers both paths in the same cycle and asserts `onSuccess` fires exactly once.1 parent 0c1d368 commit 3f6b1b0
2 files changed
Lines changed: 27 additions & 5 deletions
File tree
- apps/desktop/src/lib/file-explorer/network
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
178 | 196 | | |
179 | 197 | | |
180 | 198 | | |
| |||
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
194 | 200 | | |
195 | 201 | | |
196 | 202 | | |
| |||
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
246 | 250 | | |
247 | 251 | | |
248 | 252 | | |
| |||
0 commit comments