diff --git a/CHANGES.md b/CHANGES.md index 8502083b22..15ea363001 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,7 +16,7 @@ ### :bug: Bugs fixed -### :bug: Bugs fixed +- Fix prototype connections lost when switching between variants [Taiga #12812](https://tree.taiga.io/project/penpot/issue/12812) ## 2.13.0 (Unreleased) diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index 0d291a94f4..acc4eb1434 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -2497,7 +2497,7 @@ (-> changes (cls/generate-delete-shapes file page objects (d/ordered-set (:id shape)) - {:allow-altering-copies true :ignore-children-fn ignore-swapped-fn :ignore-mask true})) + {:allow-altering-copies true :ignore-children-fn ignore-swapped-fn :ignore-mask true :ignore-flows-for #{(:id shape)}})) [new-shape changes] (-> changes (generate-new-shape-for-swap shape file page libraries id-new-component index target-cell keep-props-values))] diff --git a/common/src/app/common/logic/shapes.cljc b/common/src/app/common/logic/shapes.cljc index 6fa3030d6e..4b74f795ef 100644 --- a/common/src/app/common/logic/shapes.cljc +++ b/common/src/app/common/logic/shapes.cljc @@ -124,9 +124,11 @@ ;; on the deletion process. It should receive a shape and ;; return a boolean ignore-children-fn - ignore-mask] + ignore-mask + ignore-flows-for] :or {ignore-children-fn (constantly false) - ignore-mask false}}] + ignore-mask false + ignore-flows-for #{}}}] (let [objects (pcb/get-objects changes) data (pcb/get-library-data changes) page-id (pcb/get-page-id changes) @@ -194,7 +196,8 @@ (->> (:flows page) (reduce (fn [changes [id flow]] - (if (id-to-delete? (:starting-frame flow)) + (if (and (id-to-delete? (:starting-frame flow)) + (not (contains? ignore-flows-for (:starting-frame flow)))) (-> changes (pcb/with-page page) (pcb/set-flow id nil)) diff --git a/common/src/app/common/types/component.cljc b/common/src/app/common/types/component.cljc index 130bece565..01968f1373 100644 --- a/common/src/app/common/types/component.cljc +++ b/common/src/app/common/types/component.cljc @@ -140,7 +140,8 @@ :layout-item-min-w :layout-item-absolute :layout-item-z-index - :layout-item-align-self}) + :layout-item-align-self + :interactions}) (defn component-attr? "Check if some attribute is one that is involved in component syncrhonization.