Fork me on GitHub
#re-frame
<
2020-07-10
>
Quentin Le Guennec07:07:58

Hello, is the second subscription supposed to trigger a cache hit in that example? (with-let [a @(subscribe [:a])] (finally (with-let [b @(subscribe [:a])]))

mikethompson13:07:17

@quentin.leguennec1 re-frame-10x provides some information about subscription dynamics

mikethompson13:07:56

You haven't really provided enough information to answer your second question. I guess the general answer is that cache hits will occur if the subscription already exists, and not otherwise.

Quentin Le Guennec13:07:37

@mikethompson thanks, I'll look into it. Well shouldn't the cache be updated as soon as @(subscribe [:a]) is run?

Quentin Le Guennec13:07:27

oh sorry, I the code was actually wrong, I will edit it

Quentin Le Guennec13:07:12

the first binding of the second with-let is actually a subscription to :a

p-himik13:07:10

A bit unrelated - I'm not sure about using with-let inside the finally block. I may be wrong, but it sounds like a potential way to create leaks.

p-himik13:07:42

By potentially not calling dispose!. Better to ask in #reagent about using reactions in finally. Either way, if you're not sure why you need with-let in particular inside finally, then probably you need just let.

Quentin Le Guennec13:07:48

oh yeah, you mean the inner with-let. Well I think dispose! is called anyway, even with no finally` . That's what I understood at least, I'm not sure. I agree that

Quentin Le Guennec13:07:55

I agree that let would work, though