0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🐛 Fix error first time doing a component change operation

This commit is contained in:
Andrés Moya 2023-05-29 10:15:54 +02:00 committed by Alonso Torres
parent fd6001090e
commit eeaee5fd13

View file

@ -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