-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Bind handler incorrectly invalidates other variables. #7704
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
I looked at the source code, and it seems like when generating When looking at I found out that the bug is the result of a bugfix of #2444. It is the reason that This behaviour happens in renderer_invalidate, where when generating an invalidate for
It fixes the specific REPL, but introduces problems which are the source of many other issues (I would consider looking into at least #4933, #4448, #7416 and #7574)
In my example, all of these are fulfilled. To fix the issues entirely, we would need to add checks for all of the above cases before invalidating other variables. However, since the behaviour that #2444 introduced now works as it did before (change the todo REPL version to 3.49, it doesn't work again), I propose to just remove the code snippet entirely. Also, I think the behaviour that changing |
This will be fixed in Svelte 5, the dependencies are tracked at runtime now, resulting in the correct behavior. Furthermore, with the new runes API, such cases will be far easier to reason about, as you can clearly separate derivations and side effects through |
Describe the bug
REPL
Expected behaviour:
program
never changes so it is never invalidated.Actual behaviour:
program
is invalidated inside adder_x_binding, so every time the counter is increased.Expected compiler output:
function adder_x_binding(value) { counter = value; $$invalidate(1, counter); }
Actual compiler output:
function adder_x_binding(value) { counter = value; ($$invalidate(1, counter), $$invalidate(0, program)); }
Severity marked as "blocking an upgrade" as the REPL works in 3.0.1
Reproduction
REPL
Logs
No response
System Info
Example REPL tested in Firefox 104 on Windows 10.
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: