Skip to content

Fix: prevent duplicate new chats and add delete confirmation - #25

Open
darshacharya wants to merge 2 commits into
redhat-data-and-ai:mainfrom
darshacharya:fix/new-chat-duplicate-and-delete-confirm
Open

Fix: prevent duplicate new chats and add delete confirmation#25
darshacharya wants to merge 2 commits into
redhat-data-and-ai:mainfrom
darshacharya:fix/new-chat-duplicate-and-delete-confirm

Conversation

@darshacharya

Copy link
Copy Markdown

Summary

  • Prevent duplicate new chats: Clicking "New Chat" repeatedly no longer creates multiple empty chats. If an unused empty chat already exists, it navigates to it instead.
  • Delete confirmation: A styled AlertDialog (Radix UI) is now shown before deleting a chat, preventing accidental deletions.

Changes

  • src/frontend/contexts/ChatContext.tsxcreateNewChat checks for an existing empty chat before creating a new one
  • src/frontend/components/layout/AppLayout.tsxhandleDeleteChat opens a confirmation dialog instead of deleting immediately
  • src/frontend/components/ui/alert-dialog.tsx — New Radix UI alert dialog component styled for the dark theme
  • package.json — Added @radix-ui/react-alert-dialog dependency

Test plan

  • Click "New Chat" multiple times — only one empty chat should be created
  • Send a message in a chat, then click "New Chat" — a new chat should be created normally
  • Click the delete button on a chat — a confirmation dialog should appear
  • Cancel the delete dialog — the chat should remain
  • Confirm the delete dialog — the chat should be removed

sudarshan added 2 commits February 26, 2026 13:57
- Reuse existing empty chat instead of creating duplicates on repeated
  "New Chat" clicks
- Show confirmation dialog before deleting a chat

Made-with: Cursor
- Add Radix UI AlertDialog component matching the app's dark theme
- Replace window.confirm() with a proper modal featuring "Delete" and
  "Cancel" buttons
- Adds @radix-ui/react-alert-dialog dependency

Made-with: Cursor
@darshacharya

darshacharya commented Apr 6, 2026

Copy link
Copy Markdown
Author

Hey @karankraina @NP-compete @Anish701 — requesting a review on this PR when you get a chance. Thanks!

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