Not all attributes are used when considering an asset as unique

Created on 22 September 2023, about 1 year ago
Updated 6 October 2023, about 1 year ago

Problem/Motivation

The uniqueBundleId in Drupal.AjaxCommands.prototype.add_css() is not unique enough: it joins style.href and ajax.instanceIndex, but that's not enough if two assets share the same path but have different attributes. An example of where this is done is the Critical CSS module πŸ› Making other assets asynchronous fails in AJAX requests since Drupal 10.1.0 Active . This causes an error in loadjs (relevant line), the JS library which is used for loading the JS/CSS files, because it thinks we're adding the same asset twice.

Steps to reproduce

  1. Enable and configure the Critical CSS module β†’ .
  2. Try to trigger any AJAX request: can be e.g. a Webform submit.

Proposed resolution

Drupal.AjaxCommands.prototype.add_css() needs to include a hash of all attributes in the unique bundle ID.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
AjaxΒ  β†’

Last updated about 15 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024