platanus / activeadmin_addons

Extends ActiveAdmin to enable a set of great optional UX improving add-ons
MIT License
763 stars 288 forks source link

Something about v1.9.0 (probably a sub-dep?) subtly breaks CSS processing #384

Closed arubis closed 1 year ago

arubis commented 2 years ago

On bumping AA_A version to 1.9.0 from 1.8.3 on an app with latest ActiveAdmin, I noticed new errors on my Rails console for font assets:

09:36:16.076AM  INFO | [7d04557e-d968-4a1c-ba2f-91377450f2dc] [GS-cf5607dd-798c-4233-9317-525ce0e50310] Started GET "/fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700&subset=latin,latin-ext" for ::1 at 2021-12-16 09:36:16 -0700
09:36:16.084AM FATAL | [7d04557e-d968-4a1c-ba2f-91377450f2dc] [GS-cf5607dd-798c-4233-9317-525ce0e50310]
                     | [7d04557e-d968-4a1c-ba2f-91377450f2dc] [GS-cf5607dd-798c-4233-9317-525ce0e50310] ActionController::RoutingError (No route matches [GET] "/fonts.googleapis.com/css"):
                     | [7d04557e-d968-4a1c-ba2f-91377450f2dc] [GS-cf5607dd-798c-4233-9317-525ce0e50310]

and slightly different rendering when viewing the ActiveAdmin page, owing to not having that font available.

I confirmed this behavior flipping back and forth between versions; there were no other changes to my Gemfile.lock. Reviewing code changes from v1.8.3 to v1.9.0, there's nothing that stands out at me as being obviously at fault.

ActiveAdmin_Assets doesn't directly add/modify CSS font sources, and the affected CSS asset appears to live with ActiveAdmin itself, not AA_A:

assets/active_admin.self-(hash) :: With ActiveAdmin_Addons 1.8.3:

/* Active Admin CSS */
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
   ========================================================================== */
/**
 * 1. Correct the line height in all browsers.
 * 2. Prevent adjustments of font size after orientation changes in
 *    IE on Windows Phone and in iOS.
 */
@import url(//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700&subset=latin,latin-ext);
/* line 12, .direnv/ruby/gems/activeadmin-2.9.0/app/assets/stylesheets/active_admin/_normalize.scss */
(snip)

Note the absolute URI scheme for the font source (two leading slashes).

assets/active_admin.self-(hash) :: With ActiveAdmin_Addons 1.9.0:

/* Active Admin CSS */
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
   ========================================================================== */
/**
 * 1. Correct the line height in all browsers.
 * 2. Prevent adjustments of font size after orientation changes in
 *    IE on Windows Phone and in iOS.
 */
@import url(/fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700&subset=latin,latin-ext);
/* line 12, .direnv/ruby/gems/activeadmin-2.9.0/app/assets/stylesheets/active_admin/_normalize.scss */
(snip)

Note the relative URL scheme for the font source (single leading slash).

I suspect this is caused by one of your gem dependencies, though none are major version changes. Alas, I haven't investigated further; I'll just be reverting to 1.8.3 on my end, but wanted to ensure this had visibility for others in case it pops up repeatedly.

rjherrera commented 2 years ago

@arubis Thanks for the issue report!

A couple of weeks ago I had a similar problem (I would say it was the same but I can't remember precisely) and I thought it was particular issue with the project I was dealing with, as I haven't heard this from anyone else. Now that you point it out, I'll try and take a look myself. If you manage to get the time to investigate it I'd appreciate any comments or extra info, and maybe we can work this out.

For now I'll try with a fresh installation with the 1.9.0 version and see what happens.

difernandez commented 1 year ago

Thanks for reporting this, but we are now releasing v2, in beta as of now, and we don't have plans to actively support previous versions. We haven't encountered this issue in latest versions, so I'll be closing it. If anyone encounters this issue, we recommend you update to the latest version (v2.0.0.beta.2 as of writing). If you find this issue is still happening, comment here the details and we'll reopen the issue if necessary.