JavascriptComponentStorage::createOrUpdateComponentEntity should not create component entities during config sync

Created on 26 May 2025, 3 months ago

Overview

When config sync is occurring, we can assume that the config entity for the component already exists
So we shouldn't create a new one

Proposed resolution

User interface changes

πŸ› Bug report
Status

Active

Version

0.0

Component

Component sources

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

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

Comments & Activities

  • Issue created by @larowlan
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    We've not been doing that since ~4 months earlier before you created this issue, since ✨ Create a ComponentSource plugin for JS components Active :

        if ($this->configInstaller->isSyncing()) {
          return;
        }
        $this->createOrUpdateComponentEntity($entity);
    

    β€” \Drupal\experience_builder\EntityHandlers\JavascriptComponentStorage::doPostSave()

    But AFAICT the problem is that the Recipes subsystem doesn't correctly signal that config is syncing, and I bet that is why you opened this issue!

    That's why both you and I spent a lot of time figuring this out on ✨ Add automated image optimization to image component Active

        // @todo Fix upstream core bug in Recipes: it inconsistently claims to be
        // syncing when installing modules, but not when installing configuration.
        // Even though it is listed under `import`, and that should hence match the
        // behavior of the /admin/config/development/configuration/single/import UI.
        if (in_array('installRecipeConfig', array_column(debug_backtrace(), 'function'), TRUE)) {
          // Assert the bug is still present. This will start failing as soon as the
          // upstream bug is fixed.
          assert(!$this->configInstaller->isSyncing());
          return;
        }
    

    … which you (@larowlan) +1'd as the solution for now 😊 So closing this issue.

Production build 0.71.5 2024