Optimistic UI Is Dangerous When Stock Counts Matter
Published 2026-02-03 by Faraz Rahimi
Pretending a decrement succeeded before the server agrees is how two phones steal the same unit.
Tags: React, UX, Inventory, Reliability, unlisted
Optimistic UI is great for likes. It is hostile to on-hand counts. I wait for the write, then update the row. A 200ms wait is better than a negative bin.
If I must feel instant, I queue the operation with a pending state that cannot be double-submitted, not a fake success.
Conflict is a screen
If two people count the same bin, the second should see the first's result, not overwrite in silence. That is extra UI. It is cheaper than a recount day.
Undo is not a substitute for correctness
Undo that issues another write is fine. Undo that never landed is a story you tell in a postmortem.