Skip to content

feat: add new session confirmation dialog with Esc-to-back and state preservation - #37

Closed
huang-hf wants to merge 2 commits into
Frayo44:mainfrom
huang-hf:fix/confirm-dialog-ux
Closed

feat: add new session confirmation dialog with Esc-to-back and state preservation#37
huang-hf wants to merge 2 commits into
Frayo44:mainfrom
huang-hf:fix/confirm-dialog-ux

Conversation

@huang-hf

@huang-hf huang-hf commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a confirmation step before creating a new session
  • Fix: Esc on confirmation screen returns to form instead of closing the dialog
  • Fix: Form state is preserved when navigating back from confirmation

Changes

New: Confirmation dialog before session creation

When the user presses Enter to create a session, a confirmation screen is shown with a summary of the current configuration (tool, title, path, branch, etc.). The session is only created after the user confirms.

Fix: Esc returns to form

Pressing Esc on the confirmation screen now returns to the form for further editing, rather than closing the entire new session dialog.

Root cause: DialogProvider's keyboard handler fires before DialogNew's, so Esc was popping DialogNew itself off the stack entirely.

Fix: Form state preserved on back

All form values (tool, title, path, branch, worktree options, etc.) are fully restored when navigating back from the confirmation screen.

Root cause: dialog.push() unmounts DialogNew (only the top stack item is rendered by DialogProvider). When dialog.pop() is called, a new DialogNew instance is created with default signal values, losing all user input.

Solution: Before calling dialog.push(), all form signal values are saved to a module-level _savedFormState variable. When DialogNew mounts, it reads and restores from this variable, then clears it.

Test plan

  • Fill in the new session form (tool, title, path, branch, etc.)
  • Press Enter → confirmation dialog appears with correct config summary
  • Press Esc → returns to form with all values intact
  • Press Enter again → confirm creates the session successfully
  • Press Esc on the main form → closes the entire dialog (unchanged behavior)

🤖 Generated with Claude Code

huang-hf and others added 2 commits March 6, 2026 13:57
Two improvements to the new session confirmation dialog:

1. Esc on the confirmation screen now returns to the form instead of
   closing the entire dialog. Previously, DialogProvider's keyboard
   handler would intercept Esc and pop DialogNew off the stack entirely.

2. Form state is no longer lost when navigating back from confirmation.
   Previously, dialog.push() caused DialogNew to unmount, so all signal
   values were reset on re-mount. Now all form signals are saved to a
   module-level variable before pushing the confirmation dialog, and
   restored when DialogNew re-mounts after dialog.pop().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@huang-hf

huang-hf commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

Replacing with a clean branch that doesn't include unrelated copyClaudeDir changes.

@huang-hf huang-hf closed this Mar 9, 2026
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