Repository navigation
fix(ui): call useQueue's beforeProcess before every task, so autosave keeps edits made during a queued save - #18349
Closed
adrian-baker wants to merge 1 commit into
Closed
adrian-baker wants to merge 1 commit into
adrian-baker wants to merge 1 commit into
Conversation
afterProcess already runs after every task, so a task queued behind another ran after afterProcess and without a beforeProcess of its own. Autosave uses the pair to set the form's background processing flag, so an edit made during a queued autosave wasn't recorded as modified while processing, and the autosave for that edit was skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adrian-baker
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
September 28, 2026 04:54
Member
|
Hey @adrian-baker - really appreciate the contribution here. We're actively refactoring the entire The refactor enables background processing when each autosave starts, so queued saves re-enable it after the previous save clears it. Edits made during those saves stay marked as unsaved, so the next autosave picks them up. |
Author
|
Excellent, thank you, I'll keep an eye on #19203. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
useQueuenow callsbeforeProcessbefore each task it runs, instead of once before its loop.afterProcessalready runs after each task, so the two now pair up for every task.Why?
Autosave uses the two callbacks to set the form's background processing flag on and off. When a second autosave was queued behind the first, it ran after
afterProcesshad turned the flag off, and nothing turned it back on. An edit made during that save then wasn't recorded as "modified while processing", the save's response resetmodifiedtofalse, and the autosave for that edit found nothing to save. The editor's last edit was lost, although the field showed it. Fixes #18348, which has the full sequence.How?
The
beforeProcesscheck moves to the top of thewhileloop. Returningfalsestill stops processing and leaves the queue as it was, as it did before the loop. The doc comment onbeforeProcesssays it's called before each function.useQueue.spec.tsxcovers both: a task queued while another runs gets its ownbeforeProcess, and afalsefrombeforeProcessstops the task from running. The first test fails without the change, withbeforeProcessrecorded once instead of twice.The same change applies unchanged to
3.x, whereuseQueue.tsis identical. The3.xfix is #18350, without the spec, because that branch has no browser test project.🤖 Generated with Claude Code