Problem/Motivation

Apologies if this is covered elsewhere or on the related issue (3183149), or if it should be attached to the bigpipe.module component. BigPipe declares dependencies on jquery and jquery.once; deprecating jquery.once in favour of the dedicated once lib is already underway in core for 9.2.x.

BigPipe doesn't seem to have a lot of jQuery usage and what's there looks as if it could be ported to vanilla JS with the new once library.

Proposed resolution

Modify big_pipe.js such that it uses vanilla JS and the new standalone once library.

Comments

seanmacgillivray created an issue. See original summary.

seanmacgillivray’s picture

Issue summary: View changes
nod_’s picture

Status: Active » Closed (duplicate)

This will be taken care of as part of the related issue, see https://git.drupalcode.org/project/drupal/-/merge_requests/391/diffs#716...

Please review the issue and leave a comment, even if you only look at the bigpipe module!

nod_’s picture

Status: Closed (duplicate) » Active

Maybe too soon,

There is a use of Drupal.ajax (which itself depends on jquery), so that would need to be taken care of at this level or do some custom code.

seanmacgillivray’s picture

Thanks Théodore!

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

There is a use of Drupal.ajax

And that was very intentional: the goal is for BigPipe to have as close to zero JS as possible, and just re-use the AJAX system!

That being said, BigPipe uses jQuery only for a single thing:

  $(window).on('load', () => {
    …
  });

I do think we can probably get rid of at least this usage? Then as soon as the AJAX system no longer relies on jQuery, neither will the BigPipe module!

Untested patch attached 🤓🤞

wim leers’s picture

Component: javascript » big_pipe.module
Issue tags: +JavaScript
droplet’s picture

`Drupal.Ajax.prototype.success` is one can be no jQuery.
#3197003: To chop ajax.js into multiple small files

it should be no issues. If testbot is happy, I'm happy.

longwave’s picture

Status: Needs review » Needs work

Eslint is not happy, though I don't understand why from the CI log.

wim leers’s picture

Neither do I 😅

nod_’s picture

StatusFileSize
new1.65 KB

extra newline in the generated file.

NW because the dependency to jquery needs to be removed from the module libraries.yml file :)

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new507 bytes
new2.06 KB

Great point! 🙈

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Nice :)

  • catch committed 500af4b on 9.3.x
    Issue #3204273 by Wim Leers, nod_, seanmacgillivray: Remove jQuery...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Very nice.

Committed 500af4b and pushed to 9.3.x. Thanks!

andypost’s picture

Status: Fixed » Closed (fixed)

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