I have a Disqus installation on my D8 website which works fine, until I enable BigPipe. Then the comments don't load (only the field label does). Am I missing something?

Thanks!

Tal

Comments

valante created an issue. See original summary.

Anonymous’s picture

I used to have same issue. But only when logged in. (Guess that's when BigPipe is active)

But have you updated to the lastest version? I don't have any trouble with the latest version.

valante’s picture

Does "latest" mean dev? I have the last non-dev version.

Anonymous’s picture

Okay the problem came back to me. :(

Anonymous’s picture

OK. This problem is actually reproducible.
1. Login
2. Enable Big Pipe.
3. Refresh the page where disqus is used. -> Disqus does not load.
4. Uninstall Big Pipe.
5. Refresh the page where disqus is used. -> Disqus loads normally.

Note that in step 3 (when Big Pipe is enabled), the response HTML contains the disqus field.

<div data-quickedit-field-id="node/24/field_disqus/und/full">
<div id="disqus_thread">
<noscript>
  <p>
    <a href="http://localhost:8080/node/24">View the discussion thread.</a>
  </p>
</noscript>
</div>
</div>

The difference is when Big Pipe is not enabled, Disqus will attach an <iframe> to the <div id="disqus_thread">.

And even when Big Pipe is enabled, the Disqus field is NOT delivered by Big Pipe.

My guess is: the Javascript of Big Pipe conflicts with the Javascript of Disqus. Although I still need to investigate further.

Anonymous’s picture

Another discovery:
When Disqus does not load. Run the javascript code in the console manually: (note that disqus_shortname should be replaced with your actual shortname)

jQuery.ajax({
          type: 'GET',
          url: '//' + disqus_shortname + '.disqus.com/embed.js',
          dataType: 'script',
          cache: false
        });

This piece of code is inside disqus.js that the Disqus module loads, it basically loads the javascript from disqus.com.

And the comment will load.
When BigPipe is enabled, it seems that this piece of code is not executed, and therefore the comments do not load.

Maybe we should start an issue for the Disqus module.

Anonymous’s picture

I've created an new issue in Disqus: #2691401: Disqus module not working with BigPipe

wim leers’s picture

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

Category: Bug report » Support request
Status: Active » Closed (works as designed)

The Disqus module is poorly written. It does this:

$('body').once('disqus').each(function() {
  if (settings.disqus || false) {

… but when BigPipe is enabled, drupalSettings.disqus is only set later. This would also be the case if the part of the page containing Disqus comments is loaded via AJAX — this is not a BigPipe-specific problem.

So, the conclusion is simple: the Disqus module's JS needs to be fixed.

I'll cross-post this to #2691401: Disqus module not working with BigPipe.

wim leers’s picture

Status: Closed (works as designed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.