@sansaripour Making sure you see this to avoid repeating the whole message in #re-frame1👍
@p-himik thanks for you answer, final question, what do you recommend in this case?
I just use
@(subscribe [...]) everywhere. The only reason to not use
@ right away is if you want to interact with the ratom itself.
Check this out, along with the next section: https://github.com/day8/re-frame/blob/master/docs/SubscriptionsCleanup.md#another-technique
I also use
@(subscribe [...]) everywhere, I just wanted to know if the other way has strong advantages
hm. I’m not sure why you would have a memory leak problem doing:
vs not wrapping in a
(defn c  (let [x (rf/subscribe [:x]) y (rf/subscribe [:y])] (fn  [:div (if @x @y "no y")])))
If you do not deref a ratom,
on-dispose will never be called when the view is unmounted.
Same reason why you cannot use
subscribe in a re-frame or a JS event handler.
is that still true when using a form-1 and binding w/o derefing it in the
If you never
@ a sub, then it is true.
But it's OK with
(if @(subscribe [...]) @(subscribe [...]) "no y") because the second
subscribe will not be called unless the first one returns true.
cool, checking my understand
thanks for the explanation, it’s more clear now
good to know