Skip to content

Tracking only array length #3552

Answered by urugator
stellarhoof asked this question in Q&A
Oct 26, 2022 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

Atm observable array is backed by single Atom. We would need a seperate atom for length. Tbh dunno if it's intentional, legacy reasons or oversight. cc @mweststrate

Also, is there any way of tracking the array size only?

No, but you can wrap it in extra computed to prevent the outer derivation from re-running.

autorun(() => console.log(computed(() => numbers.length).get()))

Replies: 2 comments 6 replies

Comment options

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

Answer selected by stellarhoof
Comment options

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

@stellarhoof
Comment options

@mweststrate
Comment options

@mweststrate
Comment options

@stellarhoof
Comment options

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