Improve the comment on clear-subsscription-cache!

This commit is contained in:
Mike Thompson 2017-07-18 10:34:14 +10:00
parent dc5fa8b566
commit 53abcfc184
1 changed files with 8 additions and 10 deletions

View File

@ -18,17 +18,15 @@
(def query->reaction (atom {})) (def query->reaction (atom {}))
(defn clear-subscription-cache! (defn clear-subscription-cache!
"Runs on-dispose for all subscriptions we have in the subscription cache. "Causes all subscriptions to be removed from the cache.
Used to force recreation of new subscriptions. Should only be necessary Does this by:
in development. 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 This is a development time tool. Useful when reloading Figwheel code
cache. after a React exception, because React components won't have been
cleaned up properly. And this, in turn, means the subscriptions within those
Useful when reloading Figwheel code after a React exception, as React components components won't have been cleaned up correctly. So this forces the issue."
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."
[] []
(doseq [[k rxn] @query->reaction] (doseq [[k rxn] @query->reaction]
(dispose! rxn)) (dispose! rxn))