mirror of https://github.com/status-im/reagent.git
Optimize common case of listening to one derefable
This commit is contained in:
parent
97194b6fca
commit
83b21167ea
|
@ -41,8 +41,14 @@
|
|||
(when-some [obj *ratom-context*]
|
||||
(let [captured (.-cljsCaptured obj)]
|
||||
(set! (.-cljsCaptured obj)
|
||||
(conj (if (nil? captured) #{} captured)
|
||||
derefable)))))
|
||||
(if (nil? captured)
|
||||
(let [old (.-watching obj)]
|
||||
(if (and (== 1 (count old))
|
||||
(identical? derefable (first old)))
|
||||
;; Optimize common case of one deref
|
||||
old
|
||||
#{derefable}))
|
||||
(conj captured derefable))))))
|
||||
|
||||
(def reaction-counter 0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue