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 →
- Set Adminimal to the main admin theme in
/admin/appearance
- Enable JS/CSS aggregation in
/admin/config/development/performance
- Install Diff module
- Configure the revision diff page to be Visual Inline using the Admin theme
/admin/config/content/diff/general
- Clear cache
- Go to a revision diff page for a node with multiple revisions
- The resulting page (at least for me) has no theme and the aforementioned 418 responses occur on the aggregated files.
- Change the admin theme to something besides Adminimal in
/admin/appearance
- Clear cache
- Go back to same node revision diff page
- Notice that the page works as expected
- Change the admin theme back to Adminimal in
/admin/appearance
- Clear cache
- Go back to same node revision diff page
- 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.