Skip to content

Decompose App.tsx phase 2 step 3: extract useConnectionLifecycle #2154

Closed

Description

@cliffhall

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

  • useConnectionLifecycle is its own hook
  • ≥90% on all four coverage dimensions
  • npm run ci green, all three web smokes included

Activity

  1. added this to the v2.5.0 milestone on Aug 27, 2026
  2. added
    v2
    chore
    on Aug 27, 2026
  3. self-assigned this
    on Aug 27, 2026
  4. added
    refactor
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

chorerefactorv2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions