Skip to content
Discussion options

You must be logged in to vote

messages.push is a read operation on messages and push also reads the length while at the same time modifying the length. The combination of reading and writing causes the loop.

The assignment on the other hand does not perform any reads, thus not creating a dependency on messages.

(You can use $inspect.trace() inside an effect to check the dependencies. This will show messages.length in your looping code.)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@frederikhors
Comment options

@brunnerh
Comment options

Answer selected by frederikhors
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