Infinite loop on view mode creation when doing a site install with existing config

Created on 23 January 2023, almost 2 years ago

Problem/Motivation

The EntityComparison entity has a postsave function that automatically creates config when it is saved.


  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    if (!$update) {
      $this->createViewMode();

      // Flush all cache.
      drupal_flush_all_caches();
    }
  }

This takes the update situation into account, but not the situation with a site install that has existing configuration.
What happens is that Config is being imported, deleted, imported, etc. because it expects that the view mode is not there yet. Resulting in a view mode creation with a different uuid.

Long story short, we need to take into account the config syncing situation.


<h3 id="summary-proposed-resolution">Proposed resolution</h3>

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    $config_installer =  Drupal::service('config.installer');
    if ($update || $config_installer->isSyncing()) {
      return;
    }

    $this->createViewMode();

    // Flush all cache.
    drupal_flush_all_caches();
  }

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇳🇱Netherlands jefuri

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024