diff --git a/CHANGES.md b/CHANGES.md index 196ffa7153..db4728c375 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -136,6 +136,7 @@ - Fix plugin API `ShapeBase.component()` returning the outermost component instead of the immediate component in case of nested component instances [Github #9183](https://github.com/penpot/penpot/issues/9183) - Fix missing `labels.open` translation that surfaced the raw key as the typography font open-button `aria-label`, breaking screen-reader output (by @MilosM348) - Fix plugin API `shape.fills` and `shape.strokes` arrays being read-only [Github #8357](https://github.com/penpot/penpot/issues/8357) +- Fix file crashing when switching a variant [Taiga #14014](https://tree.taiga.io/project/penpot/issue/14014) ## 2.15.0 (Unreleased) diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index 39762ed139..730a4355e0 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -2119,8 +2119,8 @@ (contains? #{:auto-height :auto-width} (:grow-type current-shape)))] (loop [attrs updatable-attrs - roperations [{:type :set-touched :touched (:touched previous-shape)}] - uoperations (list {:type :set-touched :touched (:touched current-shape)})] + roperations [] + uoperations []] (if-let [attr (first attrs)] (let [sync-group (ctk/resolve-sync-group (:type previous-shape) attr) @@ -2262,7 +2262,13 @@ (let [updated-attrs (into #{} (comp (filter #(= :set (:type %))) (map :attr)) - roperations)] + roperations) + updated-sync-groups (into #{} + (keep #(ctk/resolve-sync-group (:type previous-shape) %)) + updated-attrs) + new-touched (set/union (or (:touched current-shape) #{}) updated-sync-groups) + roperations (into [{:type :set-touched :touched new-touched}] roperations) + uoperations (into [{:type :set-touched :touched (:touched current-shape)}] uoperations)] (cond-> changes (> (count roperations) 1) (-> (add-update-attr-changes current-shape container roperations uoperations)