Fork me on GitHub
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])]))


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


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


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.


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