422 when creating pattern with a name that already exists

Created on 15 July 2025, 4 days ago

Overview

Steps to reproduce

  1. Create a pattern with name "Pattern"
  2. Save it
  3. Create another pattern with name "Pattern"
  4. Confirm there's a 422 error

Proposed resolution

Instead of showing a 422, user should be able to save over the existing pattern.

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

🇫🇮Finland lauriii Finland

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

Comments & Activities

  • Issue created by @lauriii
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    This seems like a regression from [PP-1] Integrate saving sections with the backend Postponed , where \Drupal\experience_builder\Entity\Pattern::generateId() was added, which literally contains:

        if ($id_exists) {
          $id = $id . '_' . (new Random())->machineName(8);
        }
    

    So: seems like we're missing test coverage in \Drupal\Tests\experience_builder\Functional\XbConfigEntityHttpApiTest::testPattern()?

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Instead of showing a 422, user should be able to save over the existing pattern.

    Ah. I had missed this bit.

    That feels like a task/feature request — not a bug.

  • 🇫🇮Finland lauriii Finland

    Let's do the simpler thing here and make the current logic work. I had not realized we had already defined how this should work so I proposed the override based on an old design I found from Figma. In the long term it should be possible to edit sections when it becomes less relevant to be able to override them.

Production build 0.71.5 2024