DEV Community

FrozonFreak
FrozonFreak

Posted on

Don't optimistically delete — Web HIG tip #1

Optimistic UI feels snappy — until it lies about a delete.

Web HIG tip #1 (Quick #43): Never use optimistic UI for destructive confirmation. Wait for server acknowledgment before you pretend the thing is gone.

Optimistic updates are great for likes, follows, and toggles. They are dangerous for irreversible or hard-to-reverse actions. If the request fails after you already removed the row, the user thinks it worked, refreshes, and the item is back — or worse, they take another action on a ghost state and corrupt data.

Do this instead:

  • Show a clear pending / in-flight state while the mutation runs
  • Only remove or finalize the UI after the server acknowledges success
  • For reversible deletes, prefer an explicit undo window over silent optimistic removal

The Web HIG is a behavioral contract for how the web should behave — not a component library. Design systems define look; The Web HIG defines behave.

Top comments (0)