From d24f7a81a27766518a9536934f4bbc26bcdb48c3 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 16 May 2022 21:00:00 -0700 Subject: [PATCH] fixing gnarly usage of multi. Better approach is to always have innenr state. --- src/cljs/auto_ap/views/utils.cljs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cljs/auto_ap/views/utils.cljs b/src/cljs/auto_ap/views/utils.cljs index baee1b7d..cb1b5643 100644 --- a/src/cljs/auto_ap/views/utils.cljs +++ b/src/cljs/auto_ap/views/utils.cljs @@ -175,12 +175,12 @@ (filter (fn [r] (not= [:key :new?] (keys r))) (assoc-in value (into [i] (get-in template [1 :field])) - (update - (if (and e (.. e -target)) - (.. e -target -value ) - e) - :key - (fnil identity (random-uuid))) )))) + (let [this-value (if (and e (.. e -target)) + (.. e -target -value ) + e)] + (if (map? this-value) + (update this-value :key (fnil identity (random-uuid))) + this-value)) )))) (on-change (mapv (fn [v] (dissoc v :new? :key))