From 53abcfc1848973778373125797ac3d89510c1979 Mon Sep 17 00:00:00 2001 From: Mike Thompson Date: Tue, 18 Jul 2017 10:34:14 +1000 Subject: [PATCH] Improve the comment on clear-subsscription-cache! --- src/re_frame/subs.cljc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/re_frame/subs.cljc b/src/re_frame/subs.cljc index 214e15a..37a8e0a 100644 --- a/src/re_frame/subs.cljc +++ b/src/re_frame/subs.cljc @@ -18,17 +18,15 @@ (def query->reaction (atom {})) (defn clear-subscription-cache! - "Runs on-dispose for all subscriptions we have in the subscription cache. - Used to force recreation of new subscriptions. Should only be necessary - in development. + "Causes all subscriptions to be removed from the cache. + Does this by: + 1. running on-dispose on all cached subscriptions + 2. These on-dispose will then do the removal of themselves. - The on-dispose functions for the subscriptions will remove themselves from the - cache. - - Useful when reloading Figwheel code after a React exception, as React components - aren't cleaned up properly. This means a subscription's on-dispose function isn't - run when the components are destroyed. If a bad subscription caused your exception, - then you can't fix it without reloading your browser." + This is a development time tool. Useful when reloading Figwheel code + after a React exception, because React components won't have been + cleaned up properly. And this, in turn, means the subscriptions within those + components won't have been cleaned up correctly. So this forces the issue." [] (doseq [[k rxn] @query->reaction] (dispose! rxn))