ApiPublishAllController does not handle since deleted entities

Created on 6 February 2025, 2 months ago

Overview

Working ✨ Auto-save code components Active I was wondering if should clean up the auto-save entries if the Code Component was deleted, since we test that the HTTP API does support delete in \Drupal\Tests\experience_builder\Functional\XbConfigEntityHttpApiTest::testJavaScriptComponent.

But then I realized \Drupal\experience_builder\Controller\ApiPublishAllController::__invoke probably doesn't handle the case where the entity that corresponds to an auto-saved entry has been deleted.

$entity = $this->entityTypeManager->getStorage($auto_save['entity_type'])
        ->load($auto_save['entity_id']);

if ($entity instanceof PageTemplate) {
          $entity = $entity->forAutoSaveData($auto_save['data']);
          $entity->enforceIsNew(FALSE);
          $this->validatePageTemplate($entity);
        }
        else {
          assert($entity instanceof FieldableEntityInterface);

Pretty sure this assert would just fail. Since at least for code components you could probably create 1 and then decide you want to delete it before it is published, then we need to handle this.

I would assume eventually that would the case for Pages too

Proposed resolution

User interface changes

πŸ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

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

Comments & Activities

Production build 0.71.5 2024