Skip to content

Reactivity with vanX #318

Closed Answered by Tao-VanJS
HEAVYPOLY asked this question in Q&A
May 15, 2024 · 4 comments · 1 reply
Discussion options

You must be logged in to vote

I suspect this is due to a protection mechanism we introduced in VanJS 1.3.0 for circular dependencies. Specifically, if you set a state while reading the value of the state in the same binding function, the updates of the state won't trigger the binding function (protect us from circular dependency). The logic of determineSyncAction is quite complex, but I think it's possible that you're setting some fields of localCanvases, while at the same time, reading the values of these fields. Specifically, in this line:

      compositeCanvases[id] = canvas

Note that canvas is from localCanvases, thus the values of localCanvases is now the values of compositeCanvases.

And lines like:

compositeCanv…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

Comment options

You must be logged in to vote
0 replies
Answer selected by Tao-VanJS
Comment options

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