Problem/Motivation

After upgrading our site to D10.1 we got an error when trying to open the Simple Live CSS tray:

TypeError: Drupal\simple_live_css\Controller\LiveCssController::__construct(): Argument #2 ($css_collection_optimizer) must be of type Drupal\Core\Asset\CssCollectionOptimizer, Drupal\Core\Asset\CssCollectionOptimizerLazy given, called in /var/www/werkgevers/web/modules/contrib/simple_live_css/src/Controller/LiveCssController.php on line 67 in Drupal\simple_live_css\Controller\LiveCssController->__construct() (regel 54 van /var/www/werkgevers/web/modules/contrib/simple_live_css/src/Controller/LiveCssController.php).

2 services seem to use a different class now and the type validation fails:
asset.css.collection_optimizer uses CssCollectionOptimizerLazy now, and
asset.js.collection_optimizer uses JsCollectionOptimizerLazy now.

Proposed resolution

Change the types of the constructor arguments tot the ..Lazy classes.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wannesdr created an issue. See original summary.

wannesdr’s picture

Updated the fork by using the AssetCollectionOptimizerInterface so it stays backwards compatible.
I tested the change with core version 9.5, 10.0.8 and 10.1.

wannesdr’s picture

Status: Active » Reviewed & tested by the community

jhandsta’s picture

Status: Reviewed & tested by the community » Fixed

Tested this as well, the changes in the issue fork fix the regression while staying backwards compatible.
Committed, thanks @wannesdr!

jhandsta’s picture

Status: Fixed » Closed (fixed)

I made a new tag for this one, since it completely broke the module in D10.1.
Closing this issue.