Skip to content

refactor(frontend): extract useCloseSessionConfirm from App.vue - #316

Merged
attson merged 1 commit into
mainfrom
refactor/extract-close-session-confirm
Aug 4, 2026
Merged

refactor(frontend): extract useCloseSessionConfirm from App.vue#316
attson merged 1 commit into
mainfrom
refactor/extract-close-session-confirm

Conversation

@attson

@attson attson commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Fifth slice of milestone 5-a. App.vue held the "are you sure you want to close this session?" dialog state — `pendingCloseSession(s)`, `pendingCloseAction`, four computeds (title / isAi / isRunning / isRemote), open/confirm/cancel/clear helpers, and the `isRisky` + `shouldConfirm` predicates — spread across ~80 lines interleaved with other unrelated boot state.

The dialog is opened from four sites (sidebar close, tab close, pane close, multi-select close) with different follow-ups; the state itself has no dependency on anything else in App.vue except the "is this session currently open as a remote pane?" check. Move the whole state machine into `composables/useCloseSessionConfirm.ts`, injecting `isOpenRemoteSession` from the caller.

The composable exposes the same identifier names the template + call sites already used (destructured out at the App.vue side), so the four call sites and the `` bindings stay unchanged. `requestCloseSession` stays in App.vue because it also references `onSidebarClose` from the sidebar callbacks layer.

App.vue side:

  • Drop `pendingCloseSession(s)` refs + `pendingCloseAction` let.
  • Drop `isCloseRiskySession`, `shouldConfirmCloseSession`, `sessionCloseTitle`, the four `pendingClose*` computeds, `clearPendingCloseSession`, `openCloseSessionConfirm`, `confirmCloseSession`, `cancelCloseSession`.
  • Keep `isOpenRemoteSession` (used by another site too) — pass it into the composable.
  • Add composable import + single destructuring call.

Test update: the three source-text assertions that pinned the old inline structure now check the composable file for the predicate bodies and the App.vue side for the import + destructure + template wiring.

Net: App.vue -60 / +13; new composable +121. App.vue now 1949 lines (was 1982).

Test plan

  • `npm test` 1631 pass
  • `npm run build` (vue-tsc + vite) green
  • Manual: close an AI session from the sidebar → prompt appears; close a running-task session from a tab's close button → prompt appears; close a remote pane already open → no prompt; multi-select close on risky sessions → prompt lists count

Fifth slice of milestone 5-a. App.vue held the "are you sure you want
to close this session?" dialog state — pendingCloseSession(s),
pendingCloseAction, four computeds (title / isAi / isRunning /
isRemote), open/confirm/cancel/clear helpers, and the isRisky +
shouldConfirm predicates — spread across ~80 lines interleaved with
other unrelated boot state.

The dialog is opened from four sites (sidebar close, tab close, pane
close, multi-select close) with different follow-ups; the state itself
has no dependency on anything else in App.vue except the "is this
session currently open as a remote pane?" check. Move the whole state
machine into composables/useCloseSessionConfirm.ts, injecting
isOpenRemoteSession from the caller.

The composable exposes the same identifier names the template + call
sites already used (destructured out at the App.vue side), so the four
call sites and the <ConfirmCloseSessionDialog> bindings stay unchanged.
requestCloseSession stays in App.vue because it also references
onSidebarClose from the sidebar callbacks layer.

App.vue side:
- Drop pendingCloseSession(s) refs + pendingCloseAction let.
- Drop isCloseRiskySession, shouldConfirmCloseSession, sessionCloseTitle,
  the four pendingClose* computeds, clearPendingCloseSession,
  openCloseSessionConfirm, confirmCloseSession, cancelCloseSession.
- Keep isOpenRemoteSession (used by another site too) — pass it into
  the composable.
- Add composable import + single destructuring call.

App.test.ts updated: the three source-text assertions that pinned the
old inline structure now check the composable file for the predicate
bodies and the App.vue side for the import + destructure + template
wiring.

Net: App.vue -60 / +13; new composable +121. `npm test` 1631 pass;
`npm run build` green.
@attson
attson merged commit 39c09c3 into main Aug 4, 2026
7 checks passed
@attson
attson deleted the refactor/extract-close-session-confirm branch August 4, 2026 09:17
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