Skip to content

How come I need the variable here to trigger the $effect()? #11958

Closed Answered by webJose
webJose asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, everyone that might be remotely interested in the topic. After gaining more experience with Svelte v5 as well as a deeper understanding of how it works, I can finally explain what was happening to me. It is not a bug.

Required Knowledge

Effects, when run, track the signals read while their functions execute. The built list of signals read is not fixed. This list is re-done every time the effect runs..

Effects run at least once, after component initialization, either before the UI updates ($effect.pre) or after.

The Problem In My Code

The only signal in my effect is restProps. On the first run, parcel is undefined, and parcel is not reactive (not a signal). I am not showing that in …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@webJose
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by webJose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants