feat(admin): Upgrade view_component to v4.x - #6540
Conversation
95b32eb to
dda1d34
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6540 +/- ##
==========================================
+ Coverage 91.82% 92.18% +0.35%
==========================================
Files 879 1036 +157
Lines 17772 21180 +3408
==========================================
+ Hits 16320 19524 +3204
- Misses 1452 1656 +204 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dbaf4e7 to
4ee5df0
Compare
|
I brought this up in the Core Team meeting with @tvdeyen, just making a note of it here for transparency. There's an interesting concern here worth making explicit: this forces stores to upgrade the components in their storefronts too, because Solidus Storefront currently makes use of ViewComponent. |
Upgrade view component to the latest version and update the engine.rb to prevent exception during the boot. Both configurations are simple replacements. Ref: https://viewcomponent.org/CHANGELOG.html#400
The patch is not necessary anymore with ViewComponent v4.x in place.
The `config.view_component.test_controller` option was removed in favor of `vc_test_controller_class`. Ref: https://viewcomponent.org/CHANGELOG.html#breaking-changes-devtest
Prevent undefined method `logger' for class SolidusAdmin::BaseComponent after rendering a component. Switch to the default Rails logger.
Since the upgrade to ViewComponent 4.x the missing translation fallback did not work anymore, because the internal translation handling was changed in view_component. Add two more tests to test the fallback behavior as well.
The SolidusAdmin::BaseComponent does not have an initializer and it is going to propagate the super call into the base view component that changed the signature in version 4.
Upgrade also the storefront install generator to use view_component >= 4.0.
6a785ff to
8206d8b
Compare
`solidus_admin` is not part of the `solidus` meta-gem, so the line above doesn't cover it and the installer would fetch the latest released version from RubyGems. Adding it from the checkout makes `solidus:install` skip its own `bundle add` (it does nothing when the Gemfile already mentions the gem) so branches that change the admin are actually exercised here. This way the install generate still tries to install solidus_admin -v >= 0.2, but the gem is already in place and it resolves peer dependencies correctly.
75bb185 to
85695a9
Compare
The text variable is not used and the LinkToCartComponent does not have an initializer.
tvdeyen
left a comment
There was a problem hiding this comment.
Great work.
Regarding the starter storefront: What will happen now while upgrading to the next solidus_admin version is a Bundler resolver error during bundle install. We can assume that devs upgrading will read the error and either pin solidus_admin to a version that still works with VC 3.x (0.4.0) or will upgrade their storefront to VC v4.x. Which is in most cases a very trivial (mostly even no-op) task.
Worth a changelog entry though.
Summary
Use the latest version of view_component. It was necessary to adjust a few configurations and fix smaller glitches (missing
loggermethods and changedtranslatebehavior).This change is breaking, because the gem is only compatible with view_component >= 4.0.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: