-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: unset batch before flushing queued effects #16482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- schedule rerunning effects based on the sources that are dirty, not just rerunning them all blindly (excempting async effects which will have run by that time already)
|
🦋 Changeset detectedLatest commit: 82e431f 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 |
…he rest of this cursed function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't approve because it's 'my' PR but this LGTM. there are definitely adjacent things that could likely be finessed, but given how many issues this fixes I think we should merge it
@@ -202,9 +203,22 @@ export class Batch { | |||
this.#effects = []; | |||
this.#block_effects = []; | |||
|
|||
// If sources are written to, then work needs to happen in a separate batch, else prior sources would be mixed with | |||
// newly updated sources, which could lead to infinite loops when effects run over and over again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we've been hunting infinite loop problem in our code in 5.35.5 I am wondering if this comment means that there were indeed a possibility that svelte creates them? That'd be a relief to know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should only happen in case of async though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly! Will be interested to see if this version fixes things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great simplifications!
Did anybody said already that @dummdidumm is the GOAT? 🐐 |
multiple times a day 😆 |
I wish I could claim credit for this but it's all @dummdidumm, I'm just opening a PR to make working on it easier. Essentially, we now create a fresh batch to handle any state changes that occur during effects that run after the prior batch is committed
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 test
and lint the project withpnpm lint