Refactor big_pipe module to remove dependencies on Ajax classes

Created on 2 July 2025, about 1 month ago

Problem/Motivation

We intend to deprecate the Ajax API. The big_pipe module had Javascript dependencies removed in πŸ“Œ Refactor BigPipe to use HTMX Active . The following dependencies remain in PHP:

\Drupal\big_pipe\Render\BigPipe

  • Drupal\Core\Ajax\AjaxResponse;
  • Drupal\Core\Ajax\MessageCommand;
  • Drupal\Core\Ajax\RedirectCommand;
  • Drupal\Core\Ajax\ReplaceCommand;

Proposed resolution

Revisit the work set aside in MR 12295 which used tags to enclose the rendered placeholder markup. That MR was passing all tests but was lacking a better solution for messages.

If individual messages can be rendered via a solution in πŸ› AJAX MessageCommand markup and styling differs from Theme default Active or some other means, then messages can be sent in a very similar fashion to placeholder markup.

Remaining tasks

User interface changes

No UI for BigPipe

Introduced terminology

None

API changes

Internal changes only.

Data model changes

Internal changes only.

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

big_pipe.module

Created by

πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

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

Comments & Activities

  • Issue created by @fathershawn
  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York
  • πŸ‡©πŸ‡ͺGermany Fabianx

    From Slack:

    Great work! And great work to get the first patch in.

    I pondered the messages issue a little bit - from your big refactor and I would suggest do do two template elements.

    One is a type=messages stream and one is simple replacements like the big pipe elements you already had.

    That way:

    • You keep it simple.
    • You keep the HTML as the format for data
    • Messages stream is several β€œ<messages>” HTML elements (or whatever you want to define), which you parse back to JS and then use the Drupal.message() API (simple 1:1 mapping from HTML to API call -> 1 element for each API call)

    That way:

    • Everything is template elements
    • HTML is the data format
    • Messages are added by JS (as we defined they would be)
    • BigPipe is still a very simple .swap operation with the placeholder by default
  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

    I very much affirm HTML as the data format.

    In my last draft I was sending individual messages as HTML but I now think that all we need to do is render the messages normally using '#theme' => 'status_messages'. If the theme provides the selector for the wrapper element, with fallback to core div[data-drupal-messages] we can start get the innerHTML of the incoming wrapper and swap it into the existing wrapper in the DOM using the HTMX beforeend strategy.

  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

    Discussed with @nod_ yesterday. He pointed out that we can communicate in a CR that themes need to apply the data-drupal-messages attribute to their wrapper element.

Production build 0.71.5 2024