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!
==== 2. Client-side Action Queue (Serialized Mutations) ==== Complexity: ββ When to use: Most CRUD apps with optimistic UX ===== Core idea ===== * All user actions become commands. * Commands are applied optimistically. * Commands are queued and sent to the server in order. * Next command waits until previous one resolves. ===== API calls ===== Same endpoints as before, but: * Only one in-flight mutation at a time. * Requests are sent sequentially. ===== Example flow ===== # User creates todo β optimistic add β enqueue CreateTodo # User edits that todo β optimistic edit β enqueue EditTodo(temp-id) # Server responds with real ID β client rewrites queued commands to use real ID # Next command is sent ===== How it handles fast user edits ===== * Editing a not-yet-created todo works because: - The edit command waits behind the create command. - IDs are rewritten when create resolves. * Reorder is queued behind prior mutations, ensuring server state matches expectations. ===== Trade-offs ===== * Slightly higher latency for later actions * Requires command queue + ID remapping * Still assumes server success (rollback logic is basic) β Huge reliability gain for modest complexity
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)