zendevil 2021-03-23T14:13:41.019900Z

What’s the advantage of using:

 :<- [:_id]
 (fn [id _]
   (if id "Tabs" "Sign In")
 (fn [db _]
   (if (:_id db) "Tabs" "Sign In")

achikin 2021-03-25T11:49:17.028200Z

It helps a lot if [:_id] is not just a path in the db, but a rather complicated subscription which is not easy to replicate as a function from db

kennytilton 2021-03-31T16:49:55.077200Z

@p-himik "In this particular case - none." Is that strictly correct? I thought RF, given the explicit :id subscription, would avoid propagating to :root-comp-initial-tab if sth other than :id changed in db.

p-himik 2021-03-31T16:52:30.077400Z

That's true. But in this particular case, the :root-comp-initial-tab subscription is as simple as it can get - it won't matter at all.

p-himik 2021-03-31T16:53:13.077600Z

In fact, if :_id is only used by :root-comp-initial-tab, then that might be a disadvantage even. At the very least, just because of the extra code involved.

kennytilton 2021-03-31T17:02:05.077800Z

I was thinking it important for a noob to RF to grok the short-circuiting of state propagation by RF, regardless of the de facto insignificance in the given use case. No? Still not sure if @ps picked that up, though the doc is indeed extensive.

p-himik 2021-03-23T14:17:36.020Z

In this particular case - none.

zendevil 2021-03-23T14:49:34.020200Z

can you describe a case where the former pattern would be better than the latter?

p-himik 2021-03-23T15:26:58.020500Z

As is almost always the case, it's described rather well in the excellent re-frame documentation, which IMO everybody working with re-frame should read in full at least once.

zendevil 2021-03-23T16:16:50.022200Z

Yes I’ve read this. But it doesn’t tell why pass in signals instead of accessing the dB directly even in layer 3

zendevil 2021-03-23T16:17:58.022800Z

Is it more efficient?

p-himik 2021-03-23T16:18:17.023Z

zendevil 2021-03-23T23:01:26.027100Z

I have an issue with my react component not correctly subscribing to a value. This is my view:

(let [Stack (createStackNavigator)]
      [:> (.-Navigator Stack) {:initialRouteName @(subscribe [:root-comp-initial-tab])}
       [:> (.-Screen Stack) {:name "Sign In" :options {:headerShown false}
                             :component (reactify-component google-signin-comp)}]
       [:> (.-Screen Stack) {:name "Tabs" :options {:headerShown false}
                             :component (reactify-component tabs)}]])
Notice the @(subscribe [:root-comp-initial-tab]. This is the registration:
 :<- [:signed-in-status]
 (fn [signed-in? _]
   (let [returning (if signed-in? "Tabs" "Sign In")]
     (prn "returning " returning)
When this component loads, I see “returning Tabs” (from the prn statement in the subscription) in the logs, suggesting that that’s what the value of the subscription would be. However, the actual behavior is not that. The value is not “Tabs” in the actual component. When I replace the subscription with “Tabs”, I’m seeing a different behavior. How to explain this? I am seeing “retuning Sign In” before that too, but wouldn’t the change in the return value of the subscription also automatically change the view? TLDR in my view, the value of the subscription changes but the view doesn’t change. How to fix this?

achikin 2021-03-25T11:52:40.028400Z

It looks like you’re using some js components and it’s hard to tell how exactly they treat the values you pass inside them.

achikin 2021-03-25T12:00:02.028600Z

From what you saying, it looks like the subscriptions are working fine.