Description
Steps To Reproduce
Simple way:
-
Import Penpot File:
Component Swap Bug.zip -
Select the "Socket / Circle-2" as shown in the picture below, and swap it with the "Socket / Square" component:

- At first the socket just disappears, then after a bit it just crashes. This is the report:
report (1).txt
How to re-create the file from scratch:
- Create a circle; make it a component: "Socket / Circle"
- Create a rectangle; make it a component: "Socket / Rectangle"
- Create another shape (e.g., Background Rectangle), add it to a group (Widget);
- Add an instance of the "Socket / Circle" into this group, add a group for the Instance (Sockets).
Widget (group)
|-> Sockets (group)
| L-> Instance of "Socket / Circle"
L> Background Rectangle
- Make a component out of this group.
- Create an instance of this component.
- Swap the "Socket / Circle" instance inside the instance of the Widget component with the "Socket / Rectangle".
Expected behavior
The component should swap to:

Actual behavior
The element disappear and I get a crash.
Screenshots or video
No response
Desktop (please complete the following information)
- macOS 14.5
- Chrome: Version 128.0.6613.119 (Official Build) (arm64)
Smartphone (please complete the following information)
No response
Environment (please complete the following information)
Both on https://design.penpot.app/ and on
Self-hosted, Docker version 27.1.1, build 6312585
Penpot: develop branch: eb720b0
Frontend Stack Trace
No response
Backend Stack Trace
No response
Additional context
I'm trying to create icon components that are used by other components and can be swapped. However not all the icons are the same size, so my idea was to add a group where the icon sits, and move the group inside my component.
This way when I swap the icons, their position will match the previous icon position because the group would be the one translating the icon in relation with the new component.
Sorry if it sounds convoluted, but it should be simpler to understand with the demo file and image.
Activity