Katkat

Design Real-Time Comments with Optimistic Updates

CohereFrontend Engineer · Other

Last updated

Design optimistic real-time comments with temporary identities, idempotent posting, response/event reconciliation, visible failure states, and durable history.

Design a real-time comment system with optimistic posting. When a user submits a comment, append it to the visible list immediately so the user can continue interacting while the backend request completes.

Constraints & Assumptions

The source emphasizes optimistic updates. Define ordering and delivery behavior, and include durable history and failure recovery. Do not assume that rendering a pending comment means the server accepted it.

Clarifying Questions

Can comments be edited or deleted? How are comments ordered? What happens after a timeout with an unknown commit outcome? Must another device see the same conversation?

Follow-up questions

  • What if a live event arrives before the POST response? How do you avoid duplicate comments on retry? What if the server rejects content or the user navigates away?