Skip to content

feat(admin): Upgrade view_component to v4.x - #6540

Open
sascha-karnatz wants to merge 9 commits into
solidusio:mainfrom
fcpeuro:upgrade-view-component-in-admin
Open

feat(admin): Upgrade view_component to v4.x#6540
sascha-karnatz wants to merge 9 commits into
solidusio:mainfrom
fcpeuro:upgrade-view-component-in-admin

Conversation

@sascha-karnatz

Copy link
Copy Markdown
Contributor

Summary

Use the latest version of view_component. It was necessary to adjust a few configurations and fix smaller glitches (missing logger methods and changed translate behavior).

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:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@sascha-karnatz
sascha-karnatz requested a review from a team as a code owner August 18, 2026 21:01
@github-actions github-actions Bot added changelog:solidus_admin changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem labels Aug 18, 2026
@sascha-karnatz
sascha-karnatz force-pushed the upgrade-view-component-in-admin branch from 95b32eb to dda1d34 Compare August 18, 2026 21:04
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.18%. Comparing base (1f5bf5c) to head (c8373c0).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the changelog:solidus_promotions Changes to the solidus_promotions gem label Aug 19, 2026
@sascha-karnatz
sascha-karnatz force-pushed the upgrade-view-component-in-admin branch from dbaf4e7 to 4ee5df0 Compare August 19, 2026 07:58
tvdeyen
tvdeyen previously approved these changes Aug 19, 2026

@tvdeyen tvdeyen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks

@tvdeyen tvdeyen moved this to Review in Solidus Admin Aug 19, 2026
@jarednorman

Copy link
Copy Markdown
Member

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.
@sascha-karnatz
sascha-karnatz force-pushed the upgrade-view-component-in-admin branch from 6a785ff to 8206d8b Compare August 20, 2026 07:12
@tvdeyen
tvdeyen dismissed their stale review August 20, 2026 07:14

changes

`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.
@sascha-karnatz
sascha-karnatz force-pushed the upgrade-view-component-in-admin branch from 75bb185 to 85695a9 Compare August 20, 2026 08:51
The text variable is not used and the LinkToCartComponent does not have an initializer.

@tvdeyen tvdeyen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tvdeyen tvdeyen added the changelog:breaking-change Add this to the Breaking Changes category in release notes. label Aug 21, 2026
@tvdeyen tvdeyen changed the title chore(admin): Upgrade view_component to v4.x feat(admin): Upgrade view_component to v4.x Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:breaking-change Add this to the Breaking Changes category in release notes. changelog:solidus_admin changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem changelog:solidus_promotions Changes to the solidus_promotions gem

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

3 participants