feat(agent): confirm before deleting a conversation#307
Merged
Conversation
The agent sidebar history row's trash icon deleted a conversation immediately on click, so a misclick permanently removed it. Clicking delete now opens a destructive confirmation dialog first; onDeleteConversation fires ONLY on confirm — Cancel, Escape, and backdrop click do nothing. Reuses the kit's existing Dialog primitive (error color + filled confirm + text cancel), matching the TypeToConfirmDialog destructive precedent. Focus trap, Escape, backdrop dismiss, and focus return are handled by Dialog per kit conventions. Adds four OPTIONAL, localizable label overrides to AgentSidebarHeaderLabels (deleteConfirmTitle / deleteConfirmMessage / deleteConfirmConfirmLabel / deleteConfirmCancelLabel) with EN defaults. They thread through the existing AppShell agentHeaderLabels -> header labels mechanism, so existing consumers keep working unchanged. No version bump — rides the next kit rollup release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/307/ |
Merged
I-am-nothing
added a commit
that referenced
this pull request
Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The agent sidebar's per-conversation history trash/delete control (in
AgentSidebarHeader, surfaced viaAppShellasonDeleteAgentConversation, backed byuseAgentChat/useAgentSessiondeleteConversation) deleted a conversation immediately on click (optimistic). A single misclick on that row icon permanently removed a conversation with no recovery.Change
Clicking the delete control now opens a destructive confirmation dialog first.
onDeleteConversation/onDeleteAgentConversationfires only on confirm — Cancel, Escape, and backdrop click do nothing.Dialogprimitive (src/components/ui/surfaces/dialog/Dialog.tsx) via its declarativeactionsAPI — no hand-rolled dialog. Styling matches the kit's destructive-confirm precedent (TypeToConfirmDialog):color="error"+variant="filled"confirm button,variant="text"Cancel.Escapeto dismiss, backdrop-click dismiss, focus-return to the trigger,role="dialog"/aria-modal) is handled byDialogper kit conventions.New optional, localizable labels
Four optional label overrides added to
AgentSidebarHeaderLabels, all with sensible EN defaults:deleteConfirmTitleDelete conversation?deleteConfirmMessageThis conversation will be permanently deleted.deleteConfirmConfirmLabelDeletedeleteConfirmCancelLabelCancelThey thread through the existing mechanism:
AppShellagentHeaderLabels(typedAgentSidebarHeaderProps["labels"]) →AgentSidebarHeaderlabels. Existing consumers keep working with no changes; hosts override for localization exactly like the other agent-header labels.Versioning
No
package.jsonversion bump — this rides the next kit rollup release.Verification
pnpm typecheck— clean (0 errors)pnpm test— 772 passed (added confirm / cancel / Escape / label-override tests inAgentSidebar.test.tsx; strengthened theAppShelldelete pass-through test to go through confirm)pnpm build— cleanThe pre-existing react-markdown/remark-gfm errors in
AgentSidebarMessage.tsxare unrelated and did not surface in any of the three gates here; zero new errors are attributable to the changed files.🤖 Generated with Claude Code