diff --git a/CHANGES.md b/CHANGES.md index ebd9aa992..39f0a47a3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -79,6 +79,7 @@ - Fix problem with SVG import [Github #4888](https://github.com/penpot/penpot/issues/4888) - Fix problem with overlay positions in viewer [Taiga #8464](https://tree.taiga.io/project/penpot/issue/8464) - Fix layer panel overflowing [Taiga #8665](https://tree.taiga.io/project/penpot/issue/8665) +- Fix problem when creating a component instance from grid layout [Github #4881](https://github.com/penpot/penpot/issues/4881) ## 2.1.5 diff --git a/common/src/app/common/types/shape/layout.cljc b/common/src/app/common/types/shape/layout.cljc index a999145cb..9a71931cc 100644 --- a/common/src/app/common/types/shape/layout.cljc +++ b/common/src/app/common/types/shape/layout.cljc @@ -1622,13 +1622,17 @@ (defn remap-grid-cells "Remaps the shapes ids inside the cells" [shape ids-map] - (let [do-remap-cells + (let [remap-shape + (fn [id] + (get ids-map id id)) + + remap-cell (fn [cell] (-> cell - (update :shapes #(into [] (keep ids-map) %)))) + (update :shapes #(into [] (keep remap-shape) %)))) shape (-> shape - (update :layout-grid-cells update-vals do-remap-cells))] + (update :layout-grid-cells update-vals remap-cell))] shape)) (defn merge-cells