I have 2 blocks with swiper.js around.

This 2 blocks are from the views module.

I need to print them in the theme like i want so, i load them into the preprocess_page.

$block1 = \Drupal\block\Entity\Block::load('views_block__test_1');
$variables['block1'] = \Drupal::entityTypeManager()

And the second :

$block2 = \Drupal\block\Entity\Block::load('views_block__test_2');
$variables['block2'] = \Drupal::entityTypeManager()

They have exactly the same configuration in views and block config.

But for block 1 swipper work, not for the block2 every time i load the page.

If i look at the source i got this for the second block :

<span data-big-pipe-placeholder-id="callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&amp;args%5B0%5D=views_block__test_2&amp;args%5B1%5D=full&amp;args%5B2%5D&amp;token=3_VvuYGr92bR7BowQRNlDa4VjOC0ugQafPxRFmxKk9E"></span>

For the block 1 i got the HTML render.

I don't know why the second block is cached by big-pipe and not the first block.

But my js on the ready state work every time on the first block, and depend if i clear the cache but it's not everytime, work on the second block the first time i load the page.

The callback (in the bigpipe attributes) call something at the bottom of the page after the js include.

That why my second block doesn't work ? it's not clear.

What's happen ?

  • 1
    Does the 2nd block have an exposed filter or some sort of form/pulling in uncacheable content? Bigpipe will step in for anything deemed as uncacheable e.g. has a form. You should move your JS into a drupal behavior and that code should be triggered upon bigpipe loading in the content
    – Leigh
    Sep 21, 2018 at 11:01
  • nop no exposed filter, i ll try to move the js in the drupal behavior
    – Kevin
    Sep 21, 2018 at 11:02
  • @Leigh Mason thank put the code inside the drupal.behavior solve the problem.
    – Kevin
    Sep 21, 2018 at 11:53

1 Answer 1


I don't know why the second block is cached by big-pipe and not the first block.

This depends on the auto placeholder conditions defined in services.yml and the cache metadata of the block:

  # Max-age at or below which caching is not considered worthwhile.
  # Disable by setting to -1.
  # @default 0
  max-age: 0
  # Cache contexts with a high cardinality.
  # Disable by setting to [].
  # @default ['session', 'user']
  contexts: ['session', 'user']
  # Tags with a high invalidation frequency.
  # Disable by setting to [].
  # @default []
  tags: []

As mentioned in the comments, when the module BigPipe is enabled you need to use Drupal.behaviors for your javascript, see:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.