From 11f410f3af2ef10b8d88b285cee5626980b6dd4f Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 11 Oct 2017 08:53:11 +0200 Subject: [PATCH] fix for Use of undeclared Var re-frame.core/subscribe --- src/status_im/utils/views.clj | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/status_im/utils/views.clj b/src/status_im/utils/views.clj index ba826c55c3..5c5ebc71b0 100644 --- a/src/status_im/utils/views.clj +++ b/src/status_im/utils/views.clj @@ -48,18 +48,21 @@ 2 [(first rest-body') {} (second rest-body')] 3 rest-body') [subs-bindings vars-bindings] (prepare-subs subs)] - `(defn ~n ~params - (let [~@subs-bindings] - (reagent.core/create-class - (merge ~(->> component-map - (map (fn [[k f]] - (let [args (gensym "args")] - [k `(fn [& ~args] - (let [~@vars-bindings] - (apply ~f ~args)))]))) - (into {})) - {:display-name (name '~n) - :reagent-render - (fn ~params - (let [~@vars-bindings] - ~body))})))))) + `(do + (when-not (find-ns 're-frame.core) + (require 're-frame.core)) + (defn ~n ~params + (let [~@subs-bindings] + (reagent.core/create-class + (merge ~(->> component-map + (map (fn [[k f]] + (let [args (gensym "args")] + [k `(fn [& ~args] + (let [~@vars-bindings] + (apply ~f ~args)))]))) + (into {})) + {:display-name (name '~n) + :reagent-render + (fn ~params + (let [~@vars-bindings] + ~body))})))))))