Repository navigation
fix(ai-agent): confirm before deleting a conversation, and surface delete failures - #617
Conversation
…ilures
deleteSession() removed a conversation on a single click, with no
confirmation, and swallowed any server error (catch (e) { /* ignore */ }).
A stray click destroyed a conversation irreversibly, and if the server-side
delete failed the session still vanished from the list, leaving the UI and
the database out of step with nothing shown to the user.
The trash icon now arms on first click, swapping to a confirm/cancel pair on
that row; only confirm deletes. The server delete runs first, and on failure
the session is kept in the list and an error flash is emitted via the admin's
$emitter, matching how the rest of the admin reports failures.
Three widget strings added across all locales (English text, to be
localised): confirm-delete, cancel, delete-session-failed.
Verified live on UnoPim 3.0.0: first click arms without deleting, cancel
disarms leaving all sessions, confirm removes exactly the armed one.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPG1N6dCsWFQjMUo1caPHQ
The arm-on-first-click trash button duplicated behaviour the admin already provides. `<x-admin::modal.confirm />` is mounted in the layout and the widget renders inside the same Vue root, so `open-delete-modal` reaches it directly and brings its own title, message, button styling and translations. Dropping the inline confirm UI also removes the three widget strings the PR added in English across all 34 locale files; the failure flash reuses `widget.error-generic`, which is already translated everywhere. The delete ordering fix is unchanged: the server call runs first, and a failure keeps the session in the list instead of hiding it locally.
|
Thanks for catching this — the underlying bug is real and your fix for it is correct: the server delete has to run before the local filter, and a failure must keep the session in the list rather than hiding it. That part is untouched. I've pushed Confirmation → the existing admin modal
confirmDeleteSession(sessionId) {
this.$emitter.emit('open-delete-modal', {
agree: () => this.deleteSession(sessionId),
});
},
TranslationsThe three new widget keys were added to all 34 locale files with the English value. Our rule is that a key lands in Reusing the modal removes the need for CommentsThe Blade block comment and the three-line comment inside One smaller thing
VerifiedBlade compiles and the compiled output lints clean; Pint passes; no dangling references; the Not verified, and worth your time: a live run. Your verification table asserts on the arm/confirm rows, which no longer exist — the flow is now trash → delete modal → Delete/Cancel. Could you re-run that against the modal before this merges? |
Deleting a conversation in the Agentic PIM widget is destructive and irreversible, but
deleteSession()did it on a single click with no confirmation, and swallowed any server error:Two problems:
The change
confirm().this.$emitter?.emit?.("add-flash", ...), the same mechanism the rest of the admin (e.g. the data-transfer job tracker) uses. Optional-chained so it degrades quietly if the emitter is absent.confirm-delete,cancel,delete-session-failed.Verification
Live on UnoPim 3.0.0:
Screens driven through the real widget in the admin, asserting on the persisted session list at each step.