What a slow upload taught me about autosave
An upload and a text edit can finish in either order. I use one save queue so they can land together while edits from another tab still get conflict protection.
Two actions, one draft
Imagine attaching a photo to a draft and editing the title while it uploads. Autosave can commit the title first. If the upload finishes with a snapshot taken before that edit, its save can conflict with the editor’s own work. An unconditional retry could overwrite the newer title.
Send the change through one save queue
The upload can run in parallel. When it finishes, hand the editor a small change that attaches the photo. Queue that change alongside text edits, using the latest draft and the saved revision the editor has already acknowledged.
- UploadPrepare the attachment
- QueueApply it to the current draft
- SaveCheck the expected revision
If a different tab has saved a newer revision, surface the conflict and keep the user’s work available. Let the user review the saved version before reapplying the change.
Test both kinds of overlap
In one tab, make a text edit during a slow upload and reload after saving. Both changes should survive. In two tabs, save a change in the first and submit an edit from the second. The first tab’s change should survive, and the second tab should show a clear way to recover its draft.