-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Regression] Use stable sort when prioritizing app assets #209
Conversation
Thanks Chris! I was just talking about this one with a colleague who had this problem. Will just ask him to check and merge if it solves his problem too. |
Awesome, thanks for the quick review. It was certainly a head scratcher today as I was testing our Rails 8 migration! |
Alternative implementation I considered was to config.assets.paths = config.assets.paths.partition { |path| path.to_s.start_with?(Rails.root.to_s) }.flatten |
The |
Just for future reference, it seems that if all elements of the array are a |
I figured partition would allocate a couple arrays and join them back so it is probably slower. Although the arrays probably aren't large enough to matter. |
Thanks!! |
The ones causing issues for me are from importmap-rails: https://github.com/rails/importmap-rails/blob/main/lib/importmap/engine.rb#L46-L47 Same approach in most engines/railties I think: https://github.com/rails/mission_control-jobs/blob/main/lib/mission_control/jobs/engine.rb#L93-L94 |
Yeah, I doubt it will make that much of a difference. But the |
This fixes a regression introduced in #206.
sort_by!
doesn't preserve the original order so this loses the original order. https://ruby-doc.org/3.3.5/Array.html#method-i-sort_by-21I ran into this using esbuild and had
app/assets/builds
as the first entry in paths. After #206,app/javascript
always ended up higher priority thanapp/assets/builds
so it was finding the wrong file.