diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index c27c00b0f..448997208 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -708,11 +708,18 @@ components-v2 (features/active-feature? state "components/v2") + shape-inst (ctn/get-shape container id) + swap-slot (-> (ctn/get-shape container id) + (ctk/get-swap-slot)) changes (-> (pcb/empty-changes it) (pcb/with-container container) (pcb/with-objects (:objects container)) - (dwlh/generate-sync-shape-direct file-full libraries container id true components-v2))] + (dwlh/generate-sync-shape-direct file-full libraries container id true components-v2) + (cond-> + (some? swap-slot) + ;; We need to propagate parent changes + (dwlh/generate-sync-shape-direct file-full libraries container (:parent-id shape-inst) true components-v2)))] (log/debug :msg "RESET-COMPONENT finished" :js/rchanges (log-changes (:redo-changes changes) diff --git a/frontend/src/app/main/data/workspace/libraries_helpers.cljs b/frontend/src/app/main/data/workspace/libraries_helpers.cljs index 75fb6945a..0b86e31ae 100644 --- a/frontend/src/app/main/data/workspace/libraries_helpers.cljs +++ b/frontend/src/app/main/data/workspace/libraries_helpers.cljs @@ -620,7 +620,8 @@ shape-main (when component (if (and reset? components-v2) - (ctf/find-remote-shape container libraries shape-inst) + ;; the reset is against the ref-shape, not against the original shape of the component + (ctf/find-ref-shape file container libraries shape-inst) (ctf/get-ref-shape library component shape-inst))) shape-inst (if (and reset? components-v2) diff --git a/frontend/test/frontend_tests/state_components_sync_test.cljs b/frontend/test/frontend_tests/state_components_sync_test.cljs index 7e74291f8..1751fe9a5 100644 --- a/frontend/test/frontend_tests/state_components_sync_test.cljs +++ b/frontend/test/frontend_tests/state_components_sync_test.cljs @@ -1177,8 +1177,8 @@ (t/is (= (:fill-opacity shape1) 0)) (t/is (= (:name shape2) "Rect 1")) (t/is (= (:touched shape2) nil)) - (t/is (= (:fill-color shape2) clr/white)) - (t/is (= (:fill-opacity shape2) 1)) + (t/is (= (:fill-color shape2) clr/test)) + (t/is (= (:fill-opacity shape2) 0.5)) (t/is (= (:name c-instance2) "Board")) (t/is (= (:touched c-instance2) nil))