mirror of
https://github.com/penpot/penpot.git
synced 2026-10-30 14:30:37 +00:00
* 🐛 Fix stack overflow when applying a library update Each shape updated by a component sync added its reg-objects undo change with (update :undo-changes concat [...]). That wrapped the whole undo list in one more lazy concat per shape, with the old list at the head. After a few thousand shapes, walking the list overflowed the stack, which matches the nested LazySeq frames reported when a library update is applied. add-update-attr-changes now conjs the reg-objects before the mod-obj, so undo restores each shape and then recalculates its parents, as redo does. The trailing reg-objects also recalculated groups after undoing shapes that the sync added or removed. To keep that, add-shape-to-instance, add-shape-to-main and remove-shape now add their own undo reg-objects, conjed before their other undo changes so it runs after them. Tests cover many calls to add-update-attr-changes, a sync and undo of many shapes, and undoing a sync that moves, adds or removes a child of a group in the copy. Closes #12576 AI-assisted-by: claude-opus-5-5 * 🐛 Test undo of an inverse sync that adds a shape The previous commit added an undo :reg-objects to add-shape-to-main, so undoing an "update main component" recalculates the main's groups after removing the added shapes. No test covered it. The new test adds a shape at the start of a group in the copy and changes a sibling's fill, runs the inverse sync and undoes it. Without the undo reg, the main group keeps the bounds of the removed shape. AI-assisted-by: claude-opus-5-5