Codstak
    • Home
    • DSA
    • JavaScript
    • TypeScript
    • Node.js
    • React
    • More↓
      BlogReact PrepPricingDiscordNewsletterLeaderboard
    React challenge/hard

    Recover an Optimistic Preference Update

    Challenge workspace

    100-120 min
    Effects and data fetchingPath 19/30
    EffectsAsync dataState & events

    Suggested first

    Make Customer Search Race-Safe

    Your workspace must pass its server-side browser checks to complete this challenge.

    Day 10 — Recover an optimistic preference update

    Make a preference change feel immediate without losing the ability to recover honestly when persistence fails.

    Requirements

    • Update only the changed preference optimistically.
    • Disable only the pending control, not the whole form.
    • Restore the previous server-backed state if its request fails.
    • Show a failure message and a way to retry.

    Interview review

    • Why should a rollback use the value from before the request?
    • How would concurrent updates to different preferences affect this design?