-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Unexpected Reactive Variable Triggered #7592
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
Surely this may be unnecessary process, but could you please tell me the actual problem / issue of this? In this case, I think that simply implementing |
Of course - this is currently an issue when trying to update the options on the A simple example: $: options = $colors.filter(color => !$hiddenColors.includes(color)); If the |
That's a behaviour in select's Try to add If you still want to apply your
TL;DR; ~ "intense" from discord and that's me. |
I'm glad it's been narrowed down further, but surely this is not working as intended? Reactive statements should react when the variables they reference are updated. I do like your workaround of using |
Essentially, the issue is that reactive statements are being executed eagerly. If such behavior is unacceptable, then you need to be addressed in the workaround like above for now. |
Describe the bug
When using a
<select>
element with its value binded to a variable, any references to reactive variables as values within an<option>
element will unexpectedly trigger an update, even though no assignment was made.Reproduction
Example 1: https://svelte.dev/repl/a050763e72284de0abbe42d28d916940
Example 2: https://svelte.dev/repl/8c9265b7a7bb4100b39df520d1b39f4f
In both examples, the variable
a
or a iteration of it is referenced as the value of the<option>
element, but is never assigned - the console log is triggered nonetheless.If the
<select>
element is no longer bound tob
, the bug disappears.The bug remains whether the
<option>
element references the reactive variable throughvalue={a}
or just{a}
within its contents.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: