Odd issue with JS/CSS Aggregation

Created on 2 February 2024, 11 months ago
Updated 3 February 2024, 11 months ago

Problem/Motivation

I encountered an odd issue where on my production site (not my local site) a certain page would result in the aggregated CSS/JS files failing to load with a 418 response (yes, the teapot one).

Steps to reproduce

As explained I could only reproduce this on my production site, and not my local machine so I wouldn't know how reproducible this could be, but...

The problem page is the revision diff page, provided by the diff module

  1. Set Adminimal to the main admin theme in /admin/appearance
  2. Enable JS/CSS aggregation in /admin/config/development/performance
  3. Install Diff module
  4. Configure the revision diff page to be Visual Inline using the Admin theme /admin/config/content/diff/general
  5. Clear cache
  6. Go to a revision diff page for a node with multiple revisions
  7. The resulting page (at least for me) has no theme and the aforementioned 418 responses occur on the aggregated files.
  8. Change the admin theme to something besides Adminimal in /admin/appearance
  9. Clear cache
  10. Go back to same node revision diff page
  11. Notice that the page works as expected
  12. Change the admin theme back to Adminimal in /admin/appearance
  13. Clear cache
  14. Go back to same node revision diff page
  15. The same 418 response error occurs on the aggregated files

I haven't had this issue on any other pages with the Adminimal theme.

The reason I figure this is an Adminimal issue (and not Diff) is it only occurs with the Adminimal theme on that certain page.

While I could never figure out why this was occurring, what I did notice is when this failure occurs, the aggregated files never get created, yet they're being referenced to in the resulting page, deleting the js/css folders in /sites/default/files would get re-generated on all other pages, but would not get regenerated for this problem page when using Adminimal.

Proposed resolution

For reasons beyond my understanding I was able to fix this by modifying adminimal_theme.libraries.yml to add adminimal_theme/global-styling dependencies to the other two libraries.

I figure this change shouldn't break anything regardless and is general good practice for library entries as the google-fonts and custom-styling libraries are kind of useless loaded without the main theme's library.

🐛 Bug report
Status

Needs review

Version

1.7

Component

Code

Created by

🇨🇦Canada mdolnik

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

Comments & Activities

Production build 0.71.5 2024