Closed ariel-codes closed 8 months ago
Maybe this isn't a bug per se – but there should be a warning on the docs since this could make VC previews available in cases that aren't desirable, such as in production.
Hey @ariel-codes, this is intentional as Lookbook requires ViewComponent previews to be available in order to render some previews correctly.
However you are totally correct - there should be a warning in the docs about this. I'll add one in when I get a chance.
I would generally recommend only loading the Lookbook gem in development if you are not using it in production:
group :development do
gem "lookbook"
end
But regardless as it is silently overriding the ViewComponent config option this should be noted somewhere. Thanks for the suggestion :)
@ariel-codes I've just added a note about this behaviour to the docs so I'm going to go ahead and close this issue now. Thanks again for bringing it to my attention!
Describe the bug
If Lookbook is before ViewComponent in the Gemfile, Lookbook overrides
config.view_component.show_previews
totrue
.To Reproduce
Repo
https://github.com/ariel-codes/vc_preview_false
Steps to reproduce the behavior
In a Rails app generated with
rails new --minimal
Gemfile
config/application.rb
bin/rails s
and navigate tohttp://localhost:3000/rails/view_components/
Expected behavior
Navigation should result in a 404, but instead shows ViewComponent previews.
Version numbers
Please complete the following information: