From ff48b3653d22e6f38d398bbf1291616fb186c39a Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Fri, 27 May 2016 11:35:31 +0200 Subject: [PATCH] Clean up circular dependency avoidance --- src/reagent/impl/component.cljs | 5 ++--- src/reagent/impl/template.cljs | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/reagent/impl/component.cljs b/src/reagent/impl/component.cljs index 7090c36..9d6dc2a 100644 --- a/src/reagent/impl/component.cljs +++ b/src/reagent/impl/component.cljs @@ -77,9 +77,8 @@ sa ($! this :cljsState (ratom/atom nil))))) -;; ugly circular dependency -(defn as-element [x] - (js/reagent.impl.template.as-element x)) +;; avoid circular dependency: this gets set from template.cljs +(defonce as-element nil) ;;; Rendering diff --git a/src/reagent/impl/template.cljs b/src/reagent/impl/template.cljs index 98b7dab..8c40760 100644 --- a/src/reagent/impl/template.cljs +++ b/src/reagent/impl/template.cljs @@ -99,7 +99,7 @@ ;;; Specialization for input components ;; This gets set from dom.cljs -(def find-dom-node nil) +(defonce find-dom-node nil) (defn input-unmount [this] ($! this :cljsInputValue nil)) @@ -322,6 +322,8 @@ (satisfies? IPrintWithWriter x) (pr-str x) :else x)) +(set! comp/as-element as-element) + (defn expand-seq [s] (let [a (into-array s)] (dotimes [i (alength a)]