diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php index d0a4ecd..806e1c3 100644 --- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php @@ -121,11 +121,6 @@ public function renderResponse(array $main_content, Request $request, RouteMatch $page['#title'] = $title; - // @todo Hack: Remove need of jQuery for BigPipe. - $page['#attached']['library'][] = 'core/drupal'; - $page['#attached']['library'][] = 'core/drupalSettings'; - $page['#attached']['library'][] = 'core/jquery'; - // Now render the rendered page.html.twig template inside the html.html.twig // template, and use the bubbled #attached metadata from $page to ensure we // load all attached assets. diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index c02d1ac..3dd1b0a 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -570,6 +570,7 @@ protected function processPlaceholders(array &$elements) { $markup = $this->renderPlaceholder($placeholder, $placeholder_elements); $elements['#markup'] = str_replace('
', $markup, $elements['#markup']); unset($elements['#cache']['placeholders'][$placeholder]); + continue; } // @todo Render strategies will need to take care of this. @@ -579,8 +580,17 @@ protected function processPlaceholders(array &$elements) { $markup = $this->renderPlaceholder($placeholder, $placeholder_elements); $elements['#markup'] = str_replace('
', $markup, $elements['#markup']); unset($elements['#cache']['placeholders'][$placeholder]); + continue; } } + + if (!empty($elements['#cache']['placeholders'])) { + // If we reach here we want to BigPipe it, hence add the JS: + // @todo Remove the need of jQuery for BigPipe. + $elements['#attached']['library'][] = 'core/drupal'; + $elements['#attached']['library'][] = 'core/drupalSettings'; + $elements['#attached']['library'][] = 'core/jquery'; + } } /**