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

Reactivity warns for signals in addEventListener handlers #11

Closed
joshwilsonvu opened this issue Mar 24, 2022 · 0 comments
Closed

Reactivity warns for signals in addEventListener handlers #11

joshwilsonvu opened this issue Mar 24, 2022 · 0 comments
Assignees

Comments

@joshwilsonvu
Copy link
Collaborator

Describe the bug
Event handlers are a special case in the reactivity rule where it's okay to read reactive variables even though the function isn't tracked by Solid. These are already accounted for in certain places:

element.onclick = () => console.log(signal());

<div onClick={() => console.log(signal())} \>

<div on:click={() => console.log(signal())} />

But the following warns:

element.addEventListener("click", () => console.log(signal()));

To Reproduce
Configure plugin, check last example.

Expected behavior
Event handlers added with addEventListener should be treated as called functions.

@joshwilsonvu joshwilsonvu self-assigned this Mar 24, 2022
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

No branches or pull requests

1 participant