From 74ff27f5b5801c6eda8ddc8af36115abd1117522 Mon Sep 17 00:00:00 2001 From: Abhishek Reddy Date: Fri, 13 Oct 2017 12:58:18 +1300 Subject: [PATCH] Reduce unnecessary evaluation of synthetic properties --- src/reagent/impl/template.cljs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/reagent/impl/template.cljs b/src/reagent/impl/template.cljs index 0625337..8ebf70a 100644 --- a/src/reagent/impl/template.cljs +++ b/src/reagent/impl/template.cljs @@ -343,9 +343,7 @@ (defn native-element [parsed argv first] (let [comp ($ parsed :name) - synthetic-input ($ parsed :syntheticInput) - synthetic-on-update ($ parsed :syntheticOnUpdate) - synthetic-on-change ($ parsed :syntheticOnChange)] + synthetic-input ($ parsed :syntheticInput)] (let [props (nth argv first nil) hasprops (or (nil? props) (map? props)) jsprops (convert-props (if hasprops props) parsed) @@ -353,7 +351,13 @@ (if (or synthetic-input (input-component? comp)) (-> (if synthetic-input ;; 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: [(reagent-input) argv comp jsprops first-child]) (with-meta (meta argv))