From 6009908d5d8e43217019925efeb84019792a9e3a Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Wed, 11 Mar 2015 17:51:54 +0100 Subject: [PATCH] Add some docs for force-update-all --- src/reagent/core.cljs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/reagent/core.cljs b/src/reagent/core.cljs index da202db..c858101 100644 --- a/src/reagent/core.cljs +++ b/src/reagent/core.cljs @@ -92,7 +92,17 @@ Returns the mounted component instance." (binding [comp/*non-reactive* true] (.' js/React renderToStaticMarkup (as-element component))))) -(defn ^:export force-update-all [] +(defn ^:export force-update-all + "Force re-rendering of all mounted Reagent components. This is + probably only useful in a development environment, when you want to + update components in response to some dynamic changes to code. + + Note that force-update-all may not update root components. This + happens if a component 'foo' is mounted with `(render [foo])` (since + functions are passed by value, and not by reference, in + ClojureScript). To get around this you'll have to introduce a layer + of indirection, for example by using `(render [#'foo])` instead." + [] (util/force-update-all)) (defn create-class