Skip to content

[codex] Refactor sessions screen state - #27

Merged
roackb2 merged 1 commit into
mainfrom
codex/refactor-sessions-screen-state
May 2, 2026
Merged

[codex] Refactor sessions screen state#27
roackb2 merged 1 commit into
mainfrom
codex/refactor-sessions-screen-state

Conversation

@roackb2

@roackb2 roackb2 commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Refactors useSessionsScreenState into focused session-screen hooks while preserving its public API.

  • Moves shared state types into sessions-screen/sessionStateTypes.
  • Extracts optimistic/live message helpers into useLiveSessionMessages.
  • Extracts session detail loading, subscription, and live event handling into useSessionDetailSubscription.
  • Extracts session creation/send/continue/cancel/settings/approval mutations into useSessionMutations.
  • Extracts turn selection and trace-backed review loading into useSessionTurnReview.
  • Replaces long live-event and trace-event if chains with extensible handler maps.

Impact

The existing app-facing hook shape remains unchanged, but the implementation is split by responsibility and is easier to extend without growing the facade or event dispatch logic.

Validation

  • yarn vitest run src/__tests__/integration/web/control-plane-sessions-state.test.tsx src/__tests__/integration/web/control-plane-sessions-screen.test.tsx
  • yarn typecheck
  • yarn test
  • yarn eslint
  • yarn build

@roackb2
roackb2 marked this pull request as ready for review May 2, 2026 04:39
@roackb2
roackb2 merged commit 12dd8df into main May 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant