Commit 81d8d3b
fix(sessions): clean global store on Hub deletes to prevent ghost session tabs
SessionsHub.handleDelete only updated its local React state via setSessions.
Because the Zustand session store is module-global and survives across
SPA navigation between Hub and TerminalApp, Hub-side deletions left
orphan entries in store.sessions and tabOrder, and never added the id
to deletedIds (which suppresses the 'Session not found' toast). On the
next SPA-nav to /terminal, the orphan id rendered as a ghost tab,
TerminalPane mounted, opened a WebSocket, and the server returned
'Session not found'.
Two-layer fix:
1. SessionsHub.handleDelete: finalize now also calls
useSessionStore.removeSession(id) (and any companion PTY).
2. TerminalApp.init(): defensive prune of orphans (sessions in store
but not on the server) before the addSession + render pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 055d6fa commit 81d8d3b
2 files changed
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
177 | 192 | | |
178 | 193 | | |
179 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
172 | 187 | | |
173 | 188 | | |
174 | 189 | | |
| |||
0 commit comments