Fork me on GitHub

In the doc, it was mentioned that: the query function triggers the view function, see However, it seems to me, it is indeed the view function triggers the query function. The query function does not know what to query without the params specified by the view function.


The documentation is correct. The exact quote, emphasis is mine: > triggers query functions to rerun The first deref in a view causes the query function (aka subscription handler) to run. Any subsequent state change (barring subscription input signals for simplicity) causes the query function to re-run. And that causes the view function to re-run. That's not specific to re-frame in any way - that's just how Reagent works with its reactions. The app-db is just a ratom, a subscription is just a reaction.


Thanks for the answer. Could you point me to some docs on WHY (instead of how) reaction could auto update the value when the tracked ratom changes?


I'm not sure if explaining "why X can do Y" is possible in general without also explaining the "how" part. :) Otherwise it will be just "because it was designed to do so". In any case, I'm not aware of such a doc. Maybe there's something useful in Reagent documentation.