Quantcast
Viewing all articles
Browse latest Browse all 294915

Single directory component CSS asset library not picked up in admin theme immediately after module install without cache clear

Problem/Motivation

After installing a new module with one or more single directory components that are immediately used and visible on the page, the CSS that comes with the SDC is not included in the admin theme.

The core issue here is the library discovery cache needs to be cleared on install. For more details see #7.

Steps to reproduce

I've created a minimal reproducible module to illustrate the issue here: https://git.drupalcode.org/sandbox/m4olivei-3460588. Clone the project an put it in your modules folder.

  • Install Drupal from scratch. eg. drush si -y standard
  • Using the UI, navigate to Admin > Extend
  • Enable the SDC Cache Issue module

Expected result

A hotpink bar should appear at the top of every page with the text "beep boop foo" aligned right. The bar being hotpink and aligned right are indicators that the componet CSS was included on the page.

Actual result

The bar is included on the page but is unstyled. The expected CSS is not included on the page.

Also note that if you navigate to the front-end theme (assuming it's different from the admin theme), the component is styled and does include the expected CSS.

In order for the expected styles to be included on the page, a cache clear is required.

Proposed resolution

Adjust the module_installer service to clear the library discovery cache on install.

Remaining tasks

  • Debug to understand the core issue. See #7
  • Adjust the module_installer service to clear the library discovery cache on install.. See MR

User interface changes

None.

API changes

The module_installer service will now clear the library discovery cache on install. This allows assets for SDC to be correctly discovered and available immediately after install, without necessitating a cache clear.

Data model changes

None.

Release notes snippet

None.


Viewing all articles
Browse latest Browse all 294915

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>