Fork me on GitHub
#fulcro
<
2019-10-16
>
henrik13:10:19

@tony.kay I ended up writing the following functions to handle the problem of acting on state changes. I already suspect I’ll have to get rid of it or refactor it later, but it’s alright as an interim solution. https://gist.github.com/eneroth/afe3f0fd9b4cadc1c684e83aec334383

tony.kay15:10:09

An optimization note: You could use the query (convert it to an AST and use the :component) to pre-pull idents, and then do ref compares on the table contents as a check before db->tree. Could improve performance.

tony.kay15:10:06

(assuming the watch has stable list of idents)

henrik15:10:58

By stable, do you mean constant?

henrik15:10:13

There’s no guarantee of that. I use it for roughly A -> Bs -> Cs, where both Bs and Cs can come and go.

henrik15:10:09

Though I never change an ident for an existing piece of data, if that’s what you mean.

henrik15:10:01

I can’t tell that there’s any difference in performance before vs. after attaching the listener, but seeing as it runs for every update to the state, no matter how unrelated, it’s certainly a theoretical concern.