-
Notifications
You must be signed in to change notification settings - Fork 442
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
Can't modify frozen autoload_paths in development environment #365
Comments
@ortegacmanuel thank you for the report and for the proposed fix! Would you be willing to provide a demo Rails application with this issue? @vinistock @juanmanuelramallo as creators of the generator and previews (where this exception is being raised: As an aside, I'm wondering if this exception involving bootsnap is a sign that we should start testing for bootsnap compatibility in our test suite. Perhaps that's something you could look into @ortegacmanuel? Having our suite fail on an error like this would be ideal. |
It might be related to: We are mutating it directly https://github.com/github/view_component/blob/master/lib/view_component/engine.rb#L29 |
I think it's worth trying out what @juanmanuelramallo pointed out. We should always prefer the public API anyways and it might be the underlying issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still an issue, because you are still mutating the view_component/lib/view_component/engine.rb Lines 83 to 84 in e85b23b
This happens only if This is fixed by using |
Setting `preview_paths` to anything else than `test/components/previews` is broken, because we mutate `ActiveSupport::Dependencies.autoload_paths`. From the Rails guides: > Please do not mutate ActiveSupport::Dependencies.autoload_paths; > the public interface to change autoload paths is config.autoload_paths. Fixes ViewComponent#365
Fixed by #2182 |
Setting `preview_paths` to anything else than `test/components/previews` is broken, because we mutate `ActiveSupport::Dependencies.autoload_paths`. From the Rails guides: > Please do not mutate ActiveSupport::Dependencies.autoload_paths; > the public interface to change autoload paths is config.autoload_paths. Refs: ViewComponent/view_component#365
Setting `preview_paths` to anything else than `test/components/previews` is broken, because we mutate `ActiveSupport::Dependencies.autoload_paths`. From the Rails guides: > Please do not mutate ActiveSupport::Dependencies.autoload_paths; > the public interface to change autoload paths is config.autoload_paths. Fixes ViewComponent#365
Setting `preview_paths` to anything else than `test/components/previews` is broken, because we mutate `ActiveSupport::Dependencies.autoload_paths`. From the Rails guides: > Please do not mutate ActiveSupport::Dependencies.autoload_paths; > the public interface to change autoload paths is config.autoload_paths. Fixes ViewComponent#365
Steps to reproduce
gem "view_component"
toGemfile
require "view_component/engine"
toconfig/application.rb
bin/rails generate component Example title content
Expected behavior
ViewComponent
Actual behavior
`<<': can't modify frozen #<Class:#Array:0x00007ff3e041bcf8> (FrozenError
System configuration
Rails version: Rails 6.0.2.1
Ruby version:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Gem version:
view_component-2.7.0
The text was updated successfully, but these errors were encountered: