Unable to recreate code component with same name after deletion

Created on 15 May 2025, 17 days ago

Overview

When a code component with a specific name (e.g., "myCode") is created, added to the component list, and then deleted, attempting to create a new code component with the same name triggers an unexpected error:

Cannot read properties of undefined (reading 'startsWith')

Steps to Reproduce:

  1. Create a code component with the name "myCode".
  2. Add the component to the component list.
  3. Delete the component from the list.
  4. Attempt to create a new code component with the name "myCode" again.
  5. Observe the error message: "Cannot read properties of undefined (reading 'startsWith')"

Proposed resolution

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mayur-sose
  • 🇮🇳India meghasharma

    I was able to reproduce this issue as described.
    Steps followed:

    - Created a code component named "myCode".
    - Added it to the component list.
    - Deleted the "myCode" component from the list.
    - Tried to create a new code component with the same name "myCode".

    The error message appears: "Cannot read properties of undefined (reading 'startsWith')" and the creation fails.

    This seems like a bug in how deleted component names are handled in memory or state.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Based on the title I expected this to be a back-end bug, though I wondered how that could be the case. But the error message suggests this is a pure client-side bug?

  • 🇮🇳India libbna New Delhi, India

    "When we create a component with the same name as one that was previously deleted, an error is thrown as described in the summary. However, after reloading the page, the component appears to have been successfully created. I believe there may be an issue with the error handling in this case.

    I’ll try to look into it, but as I’m new to Experience Builder, it would be great if someone could help me locate the relevant part of the code.

Production build 0.71.5 2024