ViewComponent > 2.46.0 causes an error
andrewmcodes opened this issue · 4 comments
I created a new Bridgetown project today and added ViewComponent the way I usually do but ran into an error I had not seen on my other website, which was using the same set up.
/Users/andrew.mason/Github/snowpack-starter/src/_components/base_component.rb:4:in `<class:BaseComponent>': uninitialized constant Rails::VERSION (NameError)
After some investigation, I think this commit may have been the issue..
I tried a few things to get rid of the error like defining Rails::VERSION
(before I saw the commit above) but ran into errors like:
/Users/andrew.mason/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/view_component-2.47.0/lib/view_component/base.rb:531:in `initialize_parameter_names':
s/module (TypeError)
I resolved the issue for now by locking view_component
to < 2.47.0
since it works fine in 2.46.0
.
group :bridgetown_plugins do
gem "bridgetown-view-component", "~> 0.7.0"
gem "view_component", "< 2.47.0"
end
Wasn't sure if the best plan was to find a way to stub this out or to open an upstream issue. WDYT?
I can provide code samples on request.
It should be easy enough to provide a Rails version to match Active Support due to lack of Railties loaded, but as for other issues I'm not sure. I haven't used the latest version of VC myself in a while. Thanks for the heads up.
@jaredcwhite it may be worth locking VC to < 2.47.0
and releasing a patch until a more permanent solution is found?
New release today as part of the Bridgetown 1.0 rollout. Should be all good now with the latest VC version!
Works great! TY @jaredcwhite !