Repository navigation
Commit afef22f
refactor(mobile): terminal lifecycle runs in a session store, not screen effects
The mobile terminal screen kept its lifecycle in 14 effects plus two
helper hooks: reopening an ended shell, closing and navigating away on
exit, replaying the grid size on each output generation, writing the
launch's initial input, resetting per-terminal state when the route
param changed, and a 180 ms buffer-replay timer.
The lifecycle now lives in a client-runtime session store
(`terminalEnvironment.createSession`), mounted with `useAtomMount`. Its
pure `transitionTerminalLifecycle` replaces `useTerminalLifecycle`, and
grid replay, initial input and paste-session resets react to the attach
stream where it lands. The screen is keyed by terminal target, so
per-terminal state resets by remount instead of keyed-entry effects. The
keyboard accessory follows will-show/will-hide through
useSyncExternalStore. The fallback surface focuses its input through an
imperative handle called from the handler.
Effects: ThreadTerminalRouteScreen 14 -> 0, NativeTerminalSurface 4 -> 2
(the streaming output writer effects from #24261 stay: they own a native
writer's lifetime), terminalLaunchContext 1 -> 0, useTerminalLifecycle
and useTerminalGridSync deleted (1 -> 0 each).
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 1c10563 commit afef22f
10 files changed
Lines changed: 972 additions & 1026 deletions
File tree
- apps/mobile/src/features/terminal
- packages/client-runtime/src/state
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
3 | 11 | | |
4 | 12 | | |
5 | 13 | | |
| |||
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
41 | 54 | | |
| 55 | + | |
42 | 56 | | |
43 | 57 | | |
44 | 58 | | |
| |||
71 | 85 | | |
72 | 86 | | |
73 | 87 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
77 | 92 | | |
78 | 93 | | |
79 | 94 | | |
| |||
89 | 104 | | |
90 | 105 | | |
91 | 106 | | |
92 | | - | |
93 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
94 | 111 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
101 | 115 | | |
102 | 116 | | |
103 | 117 | | |
| |||
200 | 214 | | |
201 | 215 | | |
202 | 216 | | |
203 | | - | |
204 | 217 | | |
205 | 218 | | |
206 | 219 | | |
| |||
224 | 237 | | |
225 | 238 | | |
226 | 239 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
| |||
257 | 261 | | |
258 | 262 | | |
259 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
260 | 276 | | |
261 | 277 | | |
262 | | - | |
| 278 | + | |
263 | 279 | | |
264 | 280 | | |
265 | 281 | | |
| |||
0 commit comments