Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/696e35f8-9d68-8009-a35a-26169c8ccbe9
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== 1. Fire-and-Forget Optimistic Updates (Baseline / Minimal Control) ==== Complexity: β When to use: Small apps, low concurrency, low correctness requirements ===== Core idea ===== * Apply optimistic updates immediately in the UI. * Send API requests immediately. * Server responses eventually reconcile state. * No attempt to serialize or block conflicting user actions. ===== API calls ===== * POST /todos β create * PATCH /todos/:id β edit * DELETE /todos/:id * PATCH /todos/reorder Calls are sent immediately on user action. ===== How it handles fast user edits ===== * Client-generated temporary IDs (e.g. temp-123) are used for new todos. * When server responds, temp IDs are replaced with real IDs. * Reorder operations are sent assuming optimistic state is correct. ===== How bugs happen ===== * User edits a todo before the server returns β edit sent with temp ID β server rejects. * Reorder is computed from optimistic order β server applies it to stale order. ===== Mitigations (still simple) ===== * Retry failed requests * Full list refetch after errors * Disable editing of newly-created todos until server responds β οΈ Still fragile under rapid interaction.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)