Loading core/modules/block/src/BlockViewBuilder.php +11 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use Drupal\Core\Plugin\ContextAwarePluginInterface; use Drupal\Core\Render\Element; use Drupal\block\Entity\Block; use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy; use Drupal\Core\Security\TrustedCallbackInterface; /** Loading Loading @@ -75,6 +76,16 @@ public function viewMultiple(array $entities = [], $view_mode = 'full', $langcod if (!$plugin instanceof CacheOptionalInterface) { $build[$entity_id]['#cache']['keys'] = ['entity_view', 'block', $entity->id()]; } else { // When a block implements CacheOptionalInterface, it will be excluded // from the dynamic render cache. Since it is also cheap to render, // prevent it being placeholdered by BigPipe. This avoids loading // BigPipe's JavaScript if this block is the only placeholder on the // page, which is likely to be the case on dynamic page cache hits. $build[$entity_id]['#placeholder_strategy_denylist'] = [ BigPipeStrategy::class => TRUE, ]; } // Allow altering of cacheability metadata or setting #create_placeholder. $this->moduleHandler->alter(['block_build', "block_build_" . $plugin->getBaseId()], $build[$entity_id], $plugin); Loading core/modules/language/tests/src/Functional/LanguageSwitchingTest.php +5 −6 Original line number Diff line number Diff line Loading @@ -89,16 +89,15 @@ public function testLanguageBlock(): void { $this->doTestLanguageBlockAnonymous($block->label()); $this->doTestLanguageBlock404($block->label(), 'system/404'); // Test 404s with big_pipe where the behavior is different for logged-in // users. // Confirm that enabling big_pipe doesn't change the behavior of the block. // Note that this is the case because the language switcher block deny lists // the big_pipe placeholder strategy, otherwise it would be subject to the // bug described in https://www.drupal.org/project/drupal/issues/3349201 \Drupal::service('module_installer')->install(['big_pipe']); $this->rebuildAll(); $this->doTestLanguageBlock404($block->label(), 'system/404'); $this->drupalLogin($this->drupalCreateUser()); // @todo This is testing the current behavior with the big_pipe module // enabled. This behavior is a bug will be fixed in // https://www.drupal.org/project/drupal/issues/3349201. $this->doTestLanguageBlock404($block->label(), '<front>'); $this->doTestLanguageBlock404($block->label(), 'system/404'); } /** Loading core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ protected function doTestFrontPageAuthenticatedWarmCache(): void { 'CacheTagInvalidationCount' => 0, 'CacheTagLookupQueryCount' => 5, 'ScriptCount' => 1, 'ScriptBytes' => 73031, 'ScriptBytes' => 13150, 'StylesheetCount' => 2, 'StylesheetBytes' => 39163, ]; Loading Loading
core/modules/block/src/BlockViewBuilder.php +11 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use Drupal\Core\Plugin\ContextAwarePluginInterface; use Drupal\Core\Render\Element; use Drupal\block\Entity\Block; use Drupal\big_pipe\Render\Placeholder\BigPipeStrategy; use Drupal\Core\Security\TrustedCallbackInterface; /** Loading Loading @@ -75,6 +76,16 @@ public function viewMultiple(array $entities = [], $view_mode = 'full', $langcod if (!$plugin instanceof CacheOptionalInterface) { $build[$entity_id]['#cache']['keys'] = ['entity_view', 'block', $entity->id()]; } else { // When a block implements CacheOptionalInterface, it will be excluded // from the dynamic render cache. Since it is also cheap to render, // prevent it being placeholdered by BigPipe. This avoids loading // BigPipe's JavaScript if this block is the only placeholder on the // page, which is likely to be the case on dynamic page cache hits. $build[$entity_id]['#placeholder_strategy_denylist'] = [ BigPipeStrategy::class => TRUE, ]; } // Allow altering of cacheability metadata or setting #create_placeholder. $this->moduleHandler->alter(['block_build', "block_build_" . $plugin->getBaseId()], $build[$entity_id], $plugin); Loading
core/modules/language/tests/src/Functional/LanguageSwitchingTest.php +5 −6 Original line number Diff line number Diff line Loading @@ -89,16 +89,15 @@ public function testLanguageBlock(): void { $this->doTestLanguageBlockAnonymous($block->label()); $this->doTestLanguageBlock404($block->label(), 'system/404'); // Test 404s with big_pipe where the behavior is different for logged-in // users. // Confirm that enabling big_pipe doesn't change the behavior of the block. // Note that this is the case because the language switcher block deny lists // the big_pipe placeholder strategy, otherwise it would be subject to the // bug described in https://www.drupal.org/project/drupal/issues/3349201 \Drupal::service('module_installer')->install(['big_pipe']); $this->rebuildAll(); $this->doTestLanguageBlock404($block->label(), 'system/404'); $this->drupalLogin($this->drupalCreateUser()); // @todo This is testing the current behavior with the big_pipe module // enabled. This behavior is a bug will be fixed in // https://www.drupal.org/project/drupal/issues/3349201. $this->doTestLanguageBlock404($block->label(), '<front>'); $this->doTestLanguageBlock404($block->label(), 'system/404'); } /** Loading
core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ protected function doTestFrontPageAuthenticatedWarmCache(): void { 'CacheTagInvalidationCount' => 0, 'CacheTagLookupQueryCount' => 5, 'ScriptCount' => 1, 'ScriptBytes' => 73031, 'ScriptBytes' => 13150, 'StylesheetCount' => 2, 'StylesheetBytes' => 39163, ]; Loading