fix: prevent re-activated stale batches from break reactivity#16959
fix: prevent re-activated stale batches from break reactivity#16959paoloricciuti wants to merge 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: bf7581c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
I still wonder if we are missing a cleanup earlier somewhere which would make this check unnecessary |
I don't think we are necessarily missing a clean-up...at most, we are doing a clean-up at the wrong time? Also weird tests are failing on node 18 while 22 and 24 works. Did something changed regarding the timing of |
|
This definitely feels like it's working around a bug rather than fixing it. But it's not just a cleanup issue — if you mount a component with a pending boundary, and all the This points at a design flaw in the relationship between boundaries and batches, which I've been trying to wrap my head round for a while now (but took a break from in the interests of shipping a conference talk). #16743 is another manifestation of the same flaw. I guess we need to get serious about fixing that. |
Isn't this exactly the problem? I agree this might require some different fixing that solves the issues for good, just asking to understand. |
|
Yeah, I'm just saying that the problem isn't that we're forgetting to unset |
|
Gotcha... I think this should be a p0 (maybe p1 since it's experimental) because if you happen to have a situation where promise B started after promise A resolves first, then you basically freeze reactivity without ANY errors. |
|
Closing in favor of #16971 |
Tweaked @dummdidumm test a bit to also show how after the stale batch was
deactivatedit was basically freezing reactivity.The problem is that if a previous promise resolves after another one the previous is restored and that re-activate an already committed branch and that just lingers around preventing new batches from being created.
The check was suggested by
codexbut I spent a bit of time figuring out if it was correct, and it seems it should work since once is committed thebatchis removed frombatchesso if acurrent_branchis not in there it should mean that it's been committed, and it's now being re-activated.Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.packages/svelte/src, add a changeset (npx changeset).Tests and linting
pnpm testand lint the project withpnpm lint