Problem

I discovered this issue when I was trying to modify the placeholder HTML code.
When I changed the placeholder HTML in BigPipeStrategy.php, BigPipe stopped working.
After investigating into the problem, I found that there are two occurrence of basically the same string:

Line 168 in file BigPipeStrategy.php:

  return [
      '#markup' => '<div data-big-pipe-placeholder-id="' . Html::escape($big_pipe_placeholder_id) . '"></div>',

Line 419 in file BigPipe.php:

 $fragments = explode('<div data-big-pipe-placeholder-id="', $html);
    array_shift($fragments);
    $order = [];

    foreach ($fragments as $fragment) {
      $t = explode('"></div>', $fragment, 2);

Proposed solution

Replace those 2 occurrences with reference to the same string. I tried adding a new BigPipeConfig.php, but there should be more elegant ways to do so.

CommentFileSizeAuthor
#5 a.patch3.16 KBAnonymous (not verified)
#3 a.patch3.16 KBAnonymous (not verified)
#2 a.patch3.47 KBAnonymous (not verified)

Comments

Anonymous’s picture

ztl8702 created an issue. See original summary.

Anonymous’s picture

StatusFileSize
new3.47 KB

Here is the patch. Incorrect. Removed.
I moved the placeholder HTML into BigPipeConfig.php.
In order to demonstrate the effects of customized placeholder HTML, I also added a css file which just turns placeholders' background into red.

Anonymous’s picture

StatusFileSize
new3.16 KB

Incorrect. Removed.

Anonymous’s picture

Anonymous’s picture

StatusFileSize
new3.16 KB
Anonymous’s picture

Also, the implementation of getPlaceholderOrder (BigPipe.php line 419) does not look robust to me.
I am still studying the code though.
It is possible to store that placeholder order information somewhere (in memory)? Because it should have been known when the placeholders are generated.

Anonymous’s picture

Project: BigPipe » Drupal core
Version: 8.x-1.0-rc1 » 8.2.x-dev
Component: Code » big_pipe.module
Anonymous’s picture

Update
The patches above were for big_pipe-rc1.
However this issue still exist in the lastest dev version (big_pipe.module of Drupal core 8.2.x).

Anonymous’s picture

Anonymous’s picture

wim leers’s picture

Status: Active » Closed (duplicate)