You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our `:on-click` function isn't actually called when the component renders. Instead, we've given the function to the browser, expecting it to get called later. The problem is, reagent and re-frame have no way to safely manage your subscription at that time. The result is a memory leak. If the browser calls your `:on-click` a thousand times, re-frame will "create" a thousand unique subscriptions, and there's no code in place to "dispose" them later.
29
+
Our `:on-click` function isn't actually called when the component renders. Instead, we've given the function to the browser, expecting it to get called later. The problem is, reagent and re-frame have no way to safely manage your subscription at that time. The result is a memory leak. If the browser calls your `:on-click` a thousand times, re-frame may "create" a thousand unique subscriptions, and there's no code in place to "dispose" them later.
30
30
31
31
### Re-frame event handlers
32
32
@@ -46,7 +46,7 @@ Calling `subscribe` inside an event handler goes against re-frame's design, whic
46
46
47
47
### Incidental safety
48
48
49
-
Calling `subscribe`*outside* a component is somewhat safe, as long as you've also called it *inside* a component.
49
+
Calling `subscribe`*outside* a render-fn is somewhat safe, as long as you've also called it *inside* a render-fn.
50
50
The *outside* one has no way to dispose, but the *inside* one might dispose later.
51
51
52
52
Of course, that requires your component to be around while your other code runs.
0 commit comments