LiveCssController TypeError after upgrading to Drupal core 10.1

Created on 18 August 2023, over 1 year ago

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.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇧🇪Belgium Wannes DR Belgium 🇧🇪

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

Comments & Activities

Production build 0.71.5 2024