Fork me on GitHub
#re-frame
<
2021-09-01
>
alexdavis11:09:48

I have a subscription chain like this

(rf/reg-sub
 ::holidays
 (fn [db]
   (prn "holidays sub")
   (:holidays db)))

(rf/reg-sub
 ::raw-people
 (fn [db] (:people db)))

(rf/reg-sub
 ::people
 :<- [::raw-people]
 :<- [::holidays]
 (fn [[people holidays]]
   (prn "people sub")
   (->> people
        (map process-db-user)
        (assoc-holidays holidays)
        (sort-by :name))))
And in my view I am subscribing to ::people, however, when I update :holidays in the db, people does not re-render. I only get "holidays sub" in the console. Am I doing something wrong here? I would expect people to render whenever its inputs change

p-himik11:09:58

Need the rest of the relevant code - how ::people is used and how you update :holidays.

alexdavis11:09:41

So I restarted my repl and now I can no longer reproduce… it just started working 🤷 I can only imagine that my code wasn’t compiling properly and I was stuck on some old version

p-himik11:09:18

Can be the case. Also, re-frame documentation has a section about subscription cache and why you need to reset it when reloading your code - might be pertinent here.

alexdavis11:09:51

Thanks, I’ll give that a read