Fix mobile terminal close keyboard dismissal (#6681)

* fix: dismiss keyboard before tab actions

* fix: reset mobile tab sheet keyboard listener
This commit is contained in:
Jinjing 2026-06-28 18:46:31 -07:00 committed by GitHub
parent 3c614b2e68
commit 31d35b14fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -2667,6 +2667,12 @@ export default function SessionScreen() {
}, [router])
useEffect(() => {
// Why: Expo can reuse this screen across worktrees. Reset pending
// keyboard listeners, snapshot floors, and tombstones so prior route state
// cannot open stale UI or reject the next worktree's first snapshot.
sessionTabActionSheetRequestSeqRef.current += 1
sessionTabActionSheetKeyboardHideSubRef.current?.remove()
sessionTabActionSheetKeyboardHideSubRef.current = null
clearTerminalCache()
activeHandleRef.current = null
activeSessionTabTypeRef.current = null
@ -2675,10 +2681,6 @@ export default function SessionScreen() {
pendingBrowserFocusPageIdRef.current = null
pendingTerminalActivationAttemptRef.current = null
initialEmptySessionAutoCreateRef.current = null
// Why: snapshot version floor and close tombstones are per-worktree. This
// screen can be reused across worktrees, so a prior worktree's high version
// would reject the next one's first snapshot (same renderer epoch) and stale
// tombstones could suppress same-id tabs.
appliedSnapshotMarkerRef.current = { epoch: null, version: -1 }
closedTabTombstonesRef.current.clear()
for (const queued of terminalGestureInputQueuesRef.current.values()) {
@ -2701,6 +2703,8 @@ export default function SessionScreen() {
setFileDocs(new Map())
clearDelayedActionTimers()
return () => {
sessionTabActionSheetRequestSeqRef.current += 1
sessionTabActionSheetKeyboardHideSubRef.current?.remove()
clearDelayedActionTimers()
}
}, [clearDelayedActionTimers, clearTerminalCache, hostId, worktreeId])