Draft
Conversation
…ffects, and block on overlaps in new branches
|
Contributor
|
Member
Author
|
|
Rich-Harris
reviewed
Mar 22, 2026
| #get_blockers() { | ||
| const blockers = []; | ||
|
|
||
| for (const batch of [...this.blockers].sort((a, b) => b.id - a.id)) { |
Member
There was a problem hiding this comment.
as far as I can see the sorting is unnecessary? the only thing we do with the resulting array is this:
Promise.all(blockers.map((b) => b.settled())).then(...);
Suggested change
| for (const batch of [...this.blockers].sort((a, b) => b.id - a.id)) { | |
| for (const batch of this.blockers) { |
Rich-Harris
reviewed
Mar 22, 2026
Rich-Harris
reviewed
Mar 22, 2026
Rich-Harris
reviewed
Mar 22, 2026
Rich-Harris
reviewed
Mar 22, 2026
Rich-Harris
reviewed
Mar 22, 2026
Rich-Harris
reviewed
Mar 22, 2026
Rich-Harris
reviewed
Mar 22, 2026
…ly reaching a more powerful version of `#commit()`? ugh)
…tly mark resulting effects as dirty
…ere can still be other work (e.g. sources, new branches) that we need to merge into another batch)
dummdidumm
added a commit
that referenced
this pull request
Mar 24, 2026
extracting this from #17971 because even if that PR is not merged these tests show that there's still a lot of cases where we're buggy, particularly around forking and new branches
dummdidumm
added a commit
that referenced
this pull request
Mar 24, 2026
extracting this from #17971 because even if that PR is not merged these tests show that there's still a lot of cases where we're buggy, particularly around forking and new branches
dummdidumm
added a commit
that referenced
this pull request
Mar 27, 2026
If a batch creates a new branch (e.g. through an if block becoming true) the previous batches so far do not know about the new effects created through that. This can lead to stale values being shown. We therefore schedule those new effects on prior batches if they are touched by a `current` value of that batch Fixes #17099 extracted from #17971
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.
This tweaks the async batch algorithm:
This also changes how
batch_valuesis computed. Duringbatch.#traversewe no longer use thepreviousvalues of earlier batches, in other words we see the latest value up to this batch. This is important to fix #17099, because the core problem of that bug is that when a later batch creates new effects with a previous value we have no good way to then update those effects after the earlier batch resolves (write versions are older for the earlier one).But that means the blocking logic now also has to include new branches: If a later batch creates a new branch that then reads a value that an earlier batch wrote, we also have to block in that case, because we cannot show the new values of the earlier batch before that one has resolved.
It also includes logic of not outright rejecting earlier batches' promises once a later batch resolves in
async_derived, because that batch might have other pending work that is either not superseeded by a later batch or will be superseeded by another batch. Instead we tell the batch which of its async work is obsolete, and if everything's obsolete we know we can savely discard it. This closes #17935 - I feel like a few more tests in that direction would be good though.As a result batches resolve in the order they are started, if they are related, and the rebase algorithm becomes obsolete.