-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Svelte 5: $effect doesn't run on updates in sveltekit but works properly in svelte 5 REPL #11628
Comments
That is expected (if you know why it happens) and unrelated to SvelteKit. The REPL patches If you want the same behavior locally, also use console.log('running effect', JSON.stringify(values)) |
Thanks for the details regarding this. I understand it now. Does this seem to be a proper way to execute some code whenever something changes in values or is there a better/clean way to do this (when conveniently using bind to modify the object properties)? $effect(() => {
JSON.stringify(values);
untrack(() => {
// execute some code whenever values changes
});
}); |
If you don't need to track deeply nested changes, I would use something like |
Thank you. Closing as unrelated to SvelteKit. |
Is there a related issue for this in Svelte? This seems to go completely against the documentation which state it should log if the value changes, which it clearly does (bind updates the EDIT: maybe I misread this; I'm seeing an issue where $inspect does not log values updated by bind, but I guess the OP was having the opposite issue? |
If A related issue: It looks like there should at least be a caveat in the docs about classes (unless |
Describe the bug
effect does not run when the object is modified using bind. This issue doesn't occur in svelte 5 repl and only happens in sveltekit.
Sample code
Reproduction
Sveltelab SvelteKit with Svelte 5 with this problem
Svelte 5 REPL without this problem
Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: