Fork me on GitHub
#re-frame
<
2021-05-31
>
pinkfrog04:05:51

In the doc, it was mentioned that: the query function triggers the view function, see https://day8.github.io/re-frame/dominoes-30k/#3-4-5-6-summary. 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.

p-himik07:05:42

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.

pinkfrog12:05:42

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?

p-himik13:05:12

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.