diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index 11a0938449..74698b9b6a 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -307,8 +307,10 @@ public function preSave(EntityStorageInterface $storage) { ksort($displays); $this->set('display', ['default' => $displays['default']] + $displays); - // @todo Check whether isSyncing is needed. - if (!$this->isSyncing()) { + // Calculating the cacheability metadata is only needed when the view is + // saved through the UI or API. It should not be done when we are syncing + // configuration or installing modules. + if (!$this->isSyncing() && !$this->hasTrustedData()) { $this->addCacheMetadata(); } }