mirror of
https://github.com/status-im/reagent.git
synced 2025-01-27 20:26:39 +00:00
Reduce unnecessary evaluation of synthetic properties
This commit is contained in:
parent
f89cd99604
commit
74ff27f5b5
@ -343,9 +343,7 @@
|
|||||||
|
|
||||||
(defn native-element [parsed argv first]
|
(defn native-element [parsed argv first]
|
||||||
(let [comp ($ parsed :name)
|
(let [comp ($ parsed :name)
|
||||||
synthetic-input ($ parsed :syntheticInput)
|
synthetic-input ($ parsed :syntheticInput)]
|
||||||
synthetic-on-update ($ parsed :syntheticOnUpdate)
|
|
||||||
synthetic-on-change ($ parsed :syntheticOnChange)]
|
|
||||||
(let [props (nth argv first nil)
|
(let [props (nth argv first nil)
|
||||||
hasprops (or (nil? props) (map? props))
|
hasprops (or (nil? props) (map? props))
|
||||||
jsprops (convert-props (if hasprops props) parsed)
|
jsprops (convert-props (if hasprops props) parsed)
|
||||||
@ -353,7 +351,13 @@
|
|||||||
(if (or synthetic-input (input-component? comp))
|
(if (or synthetic-input (input-component? comp))
|
||||||
(-> (if synthetic-input
|
(-> (if synthetic-input
|
||||||
;; If we are dealing with a synthetic input, use the synthetic-input-spec form:
|
;; If we are dealing with a synthetic input, use the synthetic-input-spec form:
|
||||||
[(reagent-synthetic-input) synthetic-on-update synthetic-on-change argv comp jsprops first-child]
|
[(reagent-synthetic-input)
|
||||||
|
($ parsed :syntheticOnUpdate)
|
||||||
|
($ parsed :syntheticOnChange)
|
||||||
|
argv
|
||||||
|
comp
|
||||||
|
jsprops
|
||||||
|
first-child]
|
||||||
;; Else use the regular input-spec form:
|
;; Else use the regular input-spec form:
|
||||||
[(reagent-input) argv comp jsprops first-child])
|
[(reagent-input) argv comp jsprops first-child])
|
||||||
(with-meta (meta argv))
|
(with-meta (meta argv))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user