Skip to content

bug: crash when swapping components which are part of another component and are inside a group #5075

Closed
@dfelinto

Description

Steps To Reproduce

Simple way:

  1. Import Penpot File:
    Component Swap Bug.zip

  2. Select the "Socket / Circle-2" as shown in the picture below, and swap it with the "Socket / Square" component:

image
  1. 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:

  1. Create a circle; make it a component: "Socket / Circle"
  2. Create a rectangle; make it a component: "Socket / Rectangle"
  3. Create another shape (e.g., Background Rectangle), add it to a group (Widget);
  4. 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 
  1. Make a component out of this group.
  2. Create an instance of this component.
  3. Swap the "Socket / Circle" instance inside the instance of the Widget component with the "Socket / Rectangle".

Expected behavior

The component should swap to:

image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmanaged on taigaThis issue has been moved to our project at Taiga.io

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions