Skip to content
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

fix event handlers that are dynamic via reactive declarations or stores #4394

Merged
merged 5 commits into from
Feb 9, 2020

Conversation

Conduitry
Copy link
Member

Fixes #4388. The existing EventHandler#reassigned logic was buggy because there would be no node_for_declaration for automatically declared reactive assignments (or for store autosubscriptions).

I initially changed it to checking this.component.var_lookup.get(node.name), but this didn't work for stores. I added a special case for node.name[0] === '$', and that did work.

But then I realized we probably didn't need this logic at all, and that we could just use the this.expression.dynamic_dependencies().length > 0 check for everything that wasn't a function, regardless of whether it was an identifier. This seemed to work, and didn't break any existing tests, and was simpler as a bonus.

@Conduitry Conduitry merged commit 7f2ffb2 into sveltejs:master Feb 9, 2020
@Conduitry Conduitry deleted the gh-4388 branch February 9, 2020 14:31
jesseskinner pushed a commit to jesseskinner/svelte that referenced this pull request Feb 27, 2020
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Element event directives reactivity
1 participant