$inspect detects change in state but $effect() doesn't
#17349
Unanswered
Keshav-writes-code
asked this question in
Q&A
Replies: 1 comment
-
|
Effects only run when read signals change. Your demo only reads the top-level signal. In the effect, read the entire tree like this: $state.snapshot(file_tree);If you want to know in more detail how effects work, read my blog article: Svelte Reactivity: Let's Talk About $Effects |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
so, i have a state which is an array of objects.
when the state gets mutated, it's detected by $inpect() block but not by $effect() block
Demo
Here
not sure if it $effect only triggers if the code inside the block actually does some sort of access to that particullar property of the object like mapping over each element of the array, etc.
Beta Was this translation helpful? Give feedback.
All reactions