Delete without "Are you sure?": Undo instead #90

Merged
jcoffey-dev merged 1 commits from feature/undo-deletes into main 2026-10-06 16:46:14 +00:00
Owner

Admin UX roadmap, item 9: Undo instead of "Are you sure?".

How it works: deleting from a list (row menu or ticked rows) or from an object's page no longer asks first. The objects vanish at once and a toast reads "Deleted example.org · Undo" (or "Deleted 3 domains") for 8 seconds. The delete is only sent to the server when that time is up, so Undo simply forgets it: nothing is re-created, so ids, secrets and history are untouched.

  • a delete the server refuses (e.g. a domain that still has accounts) brings the objects back, with the reason in a "Not deleted" toast
  • a list hides objects that are waiting, and reloads when a delete is undone or sent, also after navigating away and back
  • leaving the page while a delete waits sends it at once and asks the browser to hold on, so nothing is lost or kept silently
  • still asks first: "all matching" bulk deletes, which can reach far past the page; and changing a property from a menu (not a delete)

Also fixed: every toast closed after 5 seconds regardless of its duration, which cut the Security page's 10-second Undo short.

New: src/lib/pendingDeletes.ts (hold/undo/send, 6 tests with fake timers) and src/components/common/undoableDelete.tsx (toast, batched destroy, failure report).

Translation: 6 new strings in en.json (undoDelete.*), English only for now. The old delete-confirmation strings are now unused.

Checked locally: typecheck, lint, i18n:check, 622 tests, build, notice-check. Previewed against a real local server: delete + Undo within a second (kept on the server), form Delete without Undo (gone from the server after 8 s, toast up the full time), and a refused delete (domain with an account: came back with the reason). Not exercised in a browser: closing the tab during the window.

Admin UX roadmap, item 9: Undo instead of "Are you sure?". **How it works:** deleting from a list (row menu or ticked rows) or from an object's page no longer asks first. The objects vanish at once and a toast reads "Deleted example.org · Undo" (or "Deleted 3 domains") for 8 seconds. The delete is only sent to the server when that time is up, so Undo simply forgets it: nothing is re-created, so ids, secrets and history are untouched. - a delete the server refuses (e.g. a domain that still has accounts) brings the objects back, with the reason in a "Not deleted" toast - a list hides objects that are waiting, and reloads when a delete is undone or sent, also after navigating away and back - leaving the page while a delete waits sends it at once and asks the browser to hold on, so nothing is lost or kept silently - **still asks first:** "all matching" bulk deletes, which can reach far past the page; and changing a property from a menu (not a delete) **Also fixed:** every toast closed after 5 seconds regardless of its `duration`, which cut the Security page's 10-second Undo short. New: `src/lib/pendingDeletes.ts` (hold/undo/send, 6 tests with fake timers) and `src/components/common/undoableDelete.tsx` (toast, batched destroy, failure report). Translation: 6 new strings in en.json (`undoDelete.*`), English only for now. The old delete-confirmation strings are now unused. Checked locally: typecheck, lint, i18n:check, 622 tests, build, notice-check. Previewed against a real local server: delete + Undo within a second (kept on the server), form Delete without Undo (gone from the server after 8 s, toast up the full time), and a refused delete (domain with an account: came back with the reason). Not exercised in a browser: closing the tab during the window.
jcoffey-dev added 1 commit 2026-10-06 16:38:59 +00:00
Delete without "Are you sure?": Undo instead
ci / build (pull_request) Skipped
ci / publish (pull_request) Skipped
ci / notices (pull_request) Successful in 14s
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 1m43s
87b4fde1e9
Deleting from a list or an object's page no longer asks first. The
objects vanish at once and a toast offers Undo for 8 seconds; the delete
is sent to the server only when that time is up, so Undo just forgets
it and nothing has to be re-created. A delete the server refuses brings
the objects back with the reason. Leaving the page sends what is still
waiting. "All matching" bulk deletes, which can reach past the page,
still ask first.

Toasts now honor their own duration; they all closed after 5 seconds,
which cut short the Security page's 10-second Undo.

Admin UX roadmap, item 9.
jcoffey-dev merged commit 3726b0b4f3 into main 2026-10-06 16:46:14 +00:00
jcoffey-dev deleted branch feature/undo-deletes 2026-10-06 16:46:14 +00:00
Sign in to join this conversation.