JS and CSS aggregation broken

Created on 22 December 2023, 6 months ago
Updated 27 December 2023, 6 months ago

Problem/Motivation

When JS and CSS aggregation is enabled the following error occurs on all pages:

Error: Call to a member function get() on null in Drupal\Core\Asset\CssCollectionOptimizerLazy->generateHash() (line 47 of core/lib/Drupal/Core/Asset/AssetGroupSetHashTrait.php).

This appears to be because the CssCollectionOptimizerLazy::optimize() class calls $this->generateHash() which comes from the AssetGroupSetHashTrait. The generateHash() method expects there to be the state manager to retrieve the 'system.css_js_query_string'. Both the CssCollectionOptimizerLazy and JsCollectionOptimizerLazy use this trait.

Steps to reproduce

Enable CSS and JS aggregation.

Proposed resolution

Inject the state manager into CssCollectionOptimizerLazy and JsCollectionOptimizerLazy services.

πŸ’¬ Support request
Status

Closed: works as designed

Version

10.2 ✨

Component
Asset libraryΒ  β†’

Last updated 5 days ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom Barry_Fisher

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024