Optimistic Delete + Confirm

Optimistic UIframework/ui ↗

Each row's Delete opens a themed ConfirmAction modal; on confirm the list swaps to the shorter authoritative list.

Live

trigger, modal := ui.ConfirmAction(ui.ConfirmActionConfig{
    Name:    "opt-delete-" + item.ID,
    RPCPath: "/__site/optimistic/delete?id=" + item.ID,
})
widget.Mount(app.Router(), modal.Build()) // once, at startup
  • Ship the optimistic-ui cookbook
  • Document the mutation lifecycle
  • Pair ConfirmAction with delete
Confirm → POST → on 2xx the response replaces the list region with the authoritative shorter list. On failure (4xx) the runtime skips the swap (html-mode + non-string value = no-op), so the row stays put — try “Delete n1 (will fail)” to see it. Pair with an Undo window for a true optimistic-remove pattern (Recipe 4).