Step 3 of phase 2 of the App.tsx decomposition — see #2129 for the phase, #2126 for the whole effort.
This is a stacked PR. Its branch is cut from step 2's and its PR targets that branch, not v2/main. Do not land it before step 2.
Scope — useConnectionLifecycle(session, oauth, stores), ~700 lines
latencyMs, connectStartRef, connectErrorMessage, recordConnectError
clearOAuthResumeOnExplicitDisconnect, finalizeExplicitDisconnect, resetSessionScopedUiState
- the connection effects
setupClientForServer (~215 lines, the heaviest single function in the file)
- the ~250-line effect that drives it
onToggleConnection
onDisconnect, its effect, onReauthenticateFromBanner
Supplies the onReconnect callback step 2 injects.
Constraints carried from #2129
resetSessionScopedUiState reaches into most of phase 1's UI state to clear it on disconnect. Give it a narrow reset() surface from each phase 1 hook rather than handing it every setter — otherwise this hook depends on everything and nothing was decoupled.
- No behavior change.
Done when
Step 3 of phase 2 of the
App.tsxdecomposition — see #2129 for the phase, #2126 for the whole effort.This is a stacked PR. Its branch is cut from step 2's and its PR targets that branch, not
v2/main. Do not land it before step 2.Scope —
useConnectionLifecycle(session, oauth, stores), ~700 lineslatencyMs,connectStartRef,connectErrorMessage,recordConnectErrorclearOAuthResumeOnExplicitDisconnect,finalizeExplicitDisconnect,resetSessionScopedUiStatesetupClientForServer(~215 lines, the heaviest single function in the file)onToggleConnectiononDisconnect, its effect,onReauthenticateFromBannerSupplies the
onReconnectcallback step 2 injects.Constraints carried from #2129
resetSessionScopedUiStatereaches into most of phase 1's UI state to clear it on disconnect. Give it a narrowreset()surface from each phase 1 hook rather than handing it every setter — otherwise this hook depends on everything and nothing was decoupled.Done when
useConnectionLifecycleis its own hooknpm run cigreen, all three web smokes included