Skip to content

fix: fix session deleted before confirm#7

Open
heshunme wants to merge 1 commit into
formulahendry:mainfrom
heshunme:fix/del-session-confirm-tip
Open

fix: fix session deleted before confirm#7
heshunme wants to merge 1 commit into
formulahendry:mainfrom
heshunme:fix/del-session-confirm-tip

Conversation

@heshunme
Copy link
Copy Markdown

@heshunme heshunme commented Mar 28, 2026

On Windows, clicking the “Delete Session” button currently deletes the session immediately while simultaneously displaying the confirmation dialog—rendering the confirmation dialog ineffective. This PR fixes that issue.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue where deleting a saved session could occur immediately (making confirmation ineffective on Windows) by replacing the native confirm() flow with an in-app confirmation overlay.

Changes:

  • Introduces a pendingDeleteSessionId state to gate deletion behind explicit user confirmation.
  • Replaces the confirm('Delete this session?') call with a custom modal-style overlay and confirm/cancel actions.
  • Updates click handling to prevent delete clicks from triggering session resume.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +81 to +83
<div class="delete-dialog">
<h4>Delete this session?</h4>
<p>This only removes it from the saved session list.</p>
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete confirmation dialog doesn’t indicate which session is being deleted (e.g., title/agent). Once the overlay is open the list is visually obscured, which makes it easier to confirm the wrong deletion. Consider looking up the pending session from sessions (by id) and displaying its title/agent in the dialog text, or store the session object when prompting delete.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +88
<div
v-if="pendingDeleteSessionId"
class="delete-overlay"
@click.self="cancelDelete"
>
<div class="delete-dialog">
<h4>Delete this session?</h4>
<p>This only removes it from the saved session list.</p>
<div class="delete-actions">
<button type="button" class="cancel-btn" @click="cancelDelete">
Cancel
</button>
<button type="button" class="confirm-btn" @click="confirmDelete">
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overlay behaves like a modal, but there’s no keyboard handling (e.g., Escape to cancel) and no focus management, so keyboard users can still tab to elements behind the overlay. Consider adding an Escape handler while the dialog is open and moving initial focus into the dialog (and ideally trapping focus) to make this a true, accessible confirmation modal.

Copilot uses AI. Check for mistakes.
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.

2 participants