Skip to content

How to observe changes to an array with the $effect rune #10724

Answered by brunnerh
rgeditz asked this question in Q&A
Discussion options

You must be logged in to vote

$effect does not react to any deeper changes, so if you only specify the array variable, it would only trigger if said variable is re-assigned.

If you just want to see changes for debugging, you can use $inspect(items), which triggers on deeper changes as well. If you need an actual effect, you have to be more specific, e.g. for adding/removing evaluate items.length, or deeply evaluate the object if you need all kinds of changes.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@rgeditz
Comment options

@brunnerh
Comment options

@rgeditz
Comment options

@brunnerh
Comment options

@rgeditz
Comment options

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