Skip to content

feat(agent): confirm before deleting a conversation#307

Merged
I-am-nothing merged 1 commit into
mainfrom
feat/agent-delete-confirm
Jun 14, 2026
Merged

feat(agent): confirm before deleting a conversation#307
I-am-nothing merged 1 commit into
mainfrom
feat/agent-delete-confirm

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

Problem

The agent sidebar's per-conversation history trash/delete control (in AgentSidebarHeader, surfaced via AppShell as onDeleteAgentConversation, backed by useAgentChat/useAgentSession deleteConversation) 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 / onDeleteAgentConversation fires only on confirmCancel, Escape, and backdrop click do nothing.

  • Reuses the kit's existing Dialog primitive (src/components/ui/surfaces/dialog/Dialog.tsx) via its declarative actions API — no hand-rolled dialog. Styling matches the kit's destructive-confirm precedent (TypeToConfirmDialog): color="error" + variant="filled" confirm button, variant="text" Cancel.
  • Accessibility (focus trap, Escape to dismiss, backdrop-click dismiss, focus-return to the trigger, role="dialog"/aria-modal) is handled by Dialog per kit conventions.

New optional, localizable labels

Four optional label overrides added to AgentSidebarHeaderLabels, all with sensible EN defaults:

Prop Default
deleteConfirmTitle Delete conversation?
deleteConfirmMessage This conversation will be permanently deleted.
deleteConfirmConfirmLabel Delete
deleteConfirmCancelLabel Cancel

They thread through the existing mechanism: AppShell agentHeaderLabels (typed AgentSidebarHeaderProps["labels"]) → AgentSidebarHeader labels. Existing consumers keep working with no changes; hosts override for localization exactly like the other agent-header labels.

Versioning

No package.json version 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 in AgentSidebar.test.tsx; strengthened the AppShell delete pass-through test to go through confirm)
  • pnpm build — clean

The pre-existing react-markdown/remark-gfm errors in AgentSidebarMessage.tsx are 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

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>
@github-actions

Copy link
Copy Markdown
Contributor

Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/307/

github-actions Bot added a commit that referenced this pull request Jun 14, 2026
@I-am-nothing I-am-nothing merged commit 3f1390b into main Jun 14, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in MirrorStack Platform Jun 14, 2026
github-actions Bot added a commit that referenced this pull request Jun 14, 2026
I-am-nothing added a commit that referenced this pull request Jun 14, 2026
Rollup of #309 (sidebar reload race: width + tab restore), #307 (delete-conversation confirm dialog), #308 (gutter xl:px-10). Bump + CHANGELOG; release label publishes 0.5.8 on merge.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant