mirror of
https://github.com/status-im/reagent.git
synced 2025-01-14 13:54:08 +00:00
Unoptimize component...
Remove "optimizations" that didn't doo much good.
This commit is contained in:
parent
92984c4c56
commit
47c5fcf267
@ -13,12 +13,11 @@
|
|||||||
(defn shallow-obj-to-map [o]
|
(defn shallow-obj-to-map [o]
|
||||||
(let [ks (js-keys o)
|
(let [ks (js-keys o)
|
||||||
len (alength ks)]
|
len (alength ks)]
|
||||||
(persistent!
|
(loop [m {} i 0]
|
||||||
(loop [m (transient {}) i 0]
|
|
||||||
(if (< i len)
|
(if (< i len)
|
||||||
(let [k (aget ks i)]
|
(let [k (aget ks i)]
|
||||||
(recur (assoc! m (keyword k) (aget o k)) (inc i)))
|
(recur (assoc m (keyword k) (aget o k)) (inc i)))
|
||||||
m)))))
|
m))))
|
||||||
|
|
||||||
(defn extract-props [v]
|
(defn extract-props [v]
|
||||||
(let [p (nth v 1 nil)]
|
(let [p (nth v 1 nil)]
|
||||||
@ -85,7 +84,6 @@
|
|||||||
|
|
||||||
;;; Rendering
|
;;; Rendering
|
||||||
|
|
||||||
|
|
||||||
(defn wrap-render [c]
|
(defn wrap-render [c]
|
||||||
(let [f (.' c :reagentRender)
|
(let [f (.' c :reagentRender)
|
||||||
_ (assert (ifn? f))
|
_ (assert (ifn? f))
|
||||||
@ -132,11 +130,6 @@
|
|||||||
|
|
||||||
(def rat-opts {:no-cache true})
|
(def rat-opts {:no-cache true})
|
||||||
|
|
||||||
(defn get-render [c]
|
|
||||||
(if-some [f (.' c :cljsBoundRender)]
|
|
||||||
f
|
|
||||||
(.! c :cljsBoundRender #(do-render c))))
|
|
||||||
|
|
||||||
(def static-fns
|
(def static-fns
|
||||||
{:render
|
{:render
|
||||||
(fn render []
|
(fn render []
|
||||||
@ -145,7 +138,7 @@
|
|||||||
(let [rat (.' c :cljsRatom)]
|
(let [rat (.' c :cljsRatom)]
|
||||||
(batch/mark-rendered c)
|
(batch/mark-rendered c)
|
||||||
(if (nil? rat)
|
(if (nil? rat)
|
||||||
(ratom/run-in-reaction (get-render c) c "cljsRatom"
|
(ratom/run-in-reaction #(do-render c) c "cljsRatom"
|
||||||
batch/queue-render rat-opts)
|
batch/queue-render rat-opts)
|
||||||
(._run rat))))))})
|
(._run rat))))))})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user