-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: ensure element effects are executed in the correct order #14038
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
🦋 Changeset detectedLatest commit: de03883 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 |
commit: |
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.
LGTM — does this necessitate any changes in the docs, or no because it only affects the relative ordering of bindings and actions?
From https://svelte.dev/docs/svelte/bind:
Svelte creates an event listener that updates the bound value. If an element already has a listener for the same event, that listener will be fired before the bound value is updated.
I don't believe it does, that part of the docs still holds true. |
); | ||
if (has_action_directive) { | ||
context.state.init.push( | ||
b.stmt(has_action_directive ? b.call('$.effect', b.thunk(call)) : call) |
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.
no big deal but seemed no longer necessary to check again.
b.stmt(has_action_directive ? b.call('$.effect', b.thunk(call)) : call) | |
b.stmt(b.call('$.effect', b.thunk(call))) |
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.
thanks, this was updated
This PR changes the ordering of event handlers, bindings and actions so they're now created in order of usage – which means that they fall in line with the logic and control-flow ordering too.