You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a tricky corner case. I don't know how to describe it clearly.
But it is quite easy to reproduce and demonstrate itself.
Just open the writable store example (https://svelte.dev/examples#writable-stores),
and replace count_value = value (line 10) with
if(count_value = value)
console.log(count_value)
You will see that it is not reactive when the value is 0.
The text was updated successfully, but these errors were encountered:
zwz
changed the title
Assignment in if that evaluates to false disables reactivity
Assignment in if disables reactivity when it evaluates to false
Aug 28, 2019
The $$invalidate call in the generated code is getting stuck inside the body of the if block, and so is only getting called when the value is truthy. I'm unsure whether it would be best to call it inside the if condition or after the whole if block.
It's a tricky corner case. I don't know how to describe it clearly.
But it is quite easy to reproduce and demonstrate itself.
Just open the writable store example (https://svelte.dev/examples#writable-stores),
and replace
count_value = value
(line 10) withYou will see that it is not reactive when the value is 0.
The text was updated successfully, but these errors were encountered: