-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Loss of reactivity upon assignment in the condition #3512
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
Comments
Indeed, the compiled code doesn't have the prop invalidation in the best place: An easy solution would be to generate invalidation into the condition itself, like so: |
@mrkishi mentioned in the context of another issue the idea of making |
I made it. I was wondering if this should apply to function calls too, but for me that doesn't seem to fit into Svelte's current "best practices" (eg.: f(x += 4)). |
fixed in 3.10.1 — thanks |
To Reproduce
Describe the bug
If assign value to
toggle
in the condition, toggle classes happens only once.Expected behavior
But, if assignment take out to before the compare, it worked, as it should:
Information about your Svelte project:
Chrome 76
OS Windows 10
Svelte version 3.9.2
Rollup
Severity
Simple problem. Doesn't affect something important.
The text was updated successfully, but these errors were encountered: