From eeaee5fd13cfd04628a1058c786dd0b48348f20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 29 May 2023 10:15:54 +0200 Subject: [PATCH] :bug: Fix error first time doing a component change operation --- .../app/main/data/workspace/libraries.cljs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 29f40d1c23..52fbef829a 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -887,17 +887,18 @@ check-changes (fn [[event [old-data _mid_data _new-data]]] - (let [{:keys [changes save-undo? undo-group]} (deref event) - components-changed (reduce #(into %1 (ch/components-changed old-data %2)) - #{} - changes)] - (when (and (d/not-empty? components-changed) save-undo?) - (log/info :msg "DETECTED COMPONENTS CHANGED" - :ids (map str components-changed) - :undo-group undo-group) - (run! st/emit! - (map #(update-component-sync % (:id old-data) undo-group) - components-changed)))))] + (when old-data + (let [{:keys [changes save-undo? undo-group]} (deref event) + components-changed (reduce #(into %1 (ch/components-changed old-data %2)) + #{} + changes)] + (when (and (d/not-empty? components-changed) save-undo?) + (log/info :msg "DETECTED COMPONENTS CHANGED" + :ids (map str components-changed) + :undo-group undo-group) + (run! st/emit! + (map #(update-component-sync % (:id old-data) undo-group) + components-changed))))))] (when components-v2 (->> change-s