Using Sessionless BigPipe to ALWAYS serve using BigPipe and NEVER from PageCache when using BigPipe Paragraphs (or other functionality)

Created on 24 June 2021, over 3 years ago
Updated 23 October 2023, 11 months ago

Problem/Motivation

I'm trying to provide non-cacheable paragraphs for anonymous users using https://www.drupal.org/project/big_pipe_paragraphs β†’ and this module on Pantheon. I find that the placeholder appears on the first load after clearing cache, but on subsequent loads the paragraph is already fully rendered.

I do see Big pipe paragraphs working correctly for authenticated users.

I've tried starting a session with \Drupal::request()->getSession()->set("session_test_key", "foobar"); in the paragraph preprocess, and in the Big Pipe Paragraphs lazy builder callback, and this also did not help.

Is there a way to get this working, something I'm missing?

Thanks

Steps to Reproduce

  • Install Big Pipe Paragraphs and Big Pipe Sessionless using Lando with a Pantheon recipe, or use a test site on Pantheon.
  • Create a paragraph with custom preprocessing to render a timestamp.
  • Attach the paragraph to a node.
  • For authenticated users the paragraph will load with Big Pipe each refresh, and the timestamp will change.
  • For anonymous users the paragraph will load once with Big Pipe, and then it will load fully rendered on subsequent refreshes.
πŸ’¬ Support request
Status

Fixed

Version

2.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States awolfey

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Re-read this today.

    I see where you're coming from. I understand that in very specific scenarios, what you're asking for would help. But in most cases, it would not.

    I find that the placeholder appears on the first load after clearing cache, but on subsequent loads the paragraph is already fully rendered.

    πŸ‘† This means that this module works fine already. That's literally the behavior described on the project page πŸ˜„

    What you're asking for, is a different behavior. You're asking to not prime the page cache even when it could be primed.

    And in fact … this is already supported πŸ€“

    1. Eventually, Sessionless BigPipe calls \Drupal\big_pipe_sessionless\Render\BigPipeSessionless::primePageCache() with a HtmlResponse object to prime the Page Cache with.
    2. That calls \Drupal\page_cache\StackMiddleware\PageCache::storeResponse(), which contains this logic:
          // Allow policy rules to further restrict which responses to cache.
          if ($this->responsePolicy->check($response, $request) === ResponsePolicyInterface::DENY) {
            return FALSE;
          }
      
    3. In other words: the Page Cache will not be primed if BigPipe Paragraphs were to define a response policy that detects whether the response contains rendered BigPipe Paragraphs placeholders … which would give you exactly the behavior you're asking for 😊
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Ensured #8 would not go to waste by opening ✨ Allow configuring to *never* store in Page Cache when using Sessionless BigPipe Active . πŸ‘

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024