Fork me on GitHub

@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.


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.


(assuming the watch has stable list of idents)


By stable, do you mean constant?


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


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


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.