Releases: ViewComponent/view_component
4.0.0.rc1
Almost six years after releasing v1.0.0, we're proud to ship the first release candidate of ViewComponent 4. This release marks a shift towards a Long Term Support model for the project, having reached significant feature maturity. While contributions are always welcome, we're unlikely to accept further breaking changes or major feature additions.
Please report any issues at https://github.com/ViewComponent/view_component/issues.
Breaking changes (production)
-
Remove dependency on
ActionView::Base, eliminating the need for capture compatibility patch. In some edge cases, this change may require switching to use thehelpers.proxy. -
Require non-EOL Rails (
>= 7.1.0) and Ruby (>= 3.2.0). -
Remove
render_componentandrendermonkey patch configured withrender_monkey_patch_enabled. -
Remove deprecated
use_helper(s). Useinclude MyHelperorhelpers.proxy instead. -
Support compatibility with
Dry::Initializer. As a result,EmptyOrInvalidInitializerErrorwill no longer be raised. -
Remove default initializer from
ViewComponent::Base. Previously,ViewComponent::Basedefined a catch-all initializer that allowed components without an initializer defined to be passed arbitrary arguments. -
Remove
use_deprecated_instrumentation_nameconfiguration option. Events will always userender.view_componentname. -
Remove unnecessary
#formatmethods that returnednil. -
Remove support for variant names containing
.to be consistent with Rails. -
Rename internal methods to have
__vc_prefix if they shouldn't be used by consumers. Make internal constants private. MakeCollection#components,Slotable#register_polymorphic_slotprivate. Remove unusedComponentErrorclass. -
Use ActionView's
lookup_contextfor picking templates instead of the request format.3.15 added support for using templates that match the request format, that is if
/resource.csvis requested then
ViewComponents would pick_component.csv.erbover_component.html.erb.With this release, the request format is no longer considered and instead ViewComponent will use the Rails logic for picking the most appropriate template type, that is the csv template will be used if it matches the
Acceptheader or because the controller uses arespond_toblock to pick the response format.
Breaking changes (dev/test)
-
Rename
config.generate.component_parent_classtoconfig.generate.parent_class. -
Remove
config.test_controllerin favor ofvc_test_controller_classtest helper method. -
config.component_parent_classis nowconfig.generate.component_parent_class, moving the generator-specific option to the generator configuration namespace. -
Move previews-related configuration (
enabled,route,paths,default_layout,controller) to underpreviewsnamespace. -
config.view_component_pathis nowconfig.generate.path, as components have long since been able to exist in any directory. -
--inlinegenerator option now generates inline template. Use--callto generate#callmethod. -
Remove broken integration with
rails statsthat ignored components outside ofapp/components. -
Remove
preview_sourcefunctionality. Consider using Lookbook instead. -
Use
Nokogiri::HTML5instead ofNokogiri::HTML4for test helpers. -
Move generators to a ViewComponent namespace.
Before, ViewComponent generators pollute the generator namespace with a bunch of top level items, and claim the generic "component" name.
Now, generators live in a "view_component" module/namespace, so what was before
rails g componentis nowrails g view_component:component.
New features
- Add
SystemSpecHelpersfor use with RSpec. - Add support for including
Turbo::StreamsHelper. - Add template annotations for components with
def call. - Graduate
SlotableDefaultto be included by default. - Add
#current_templateaccessor andTemplate#pathfor diagnostic usage. - Reduce string allocations during compilation.
Bug fixes
- Fix bug where virtual path wasn't reset, breaking translations outside of components.
- Fix bug where
config.previews.enableddidn't function properly in production environments. - Fix bug where response format wasn't set, which caused issues with Turbo Frames.
- Fix bug in
SlotableDefaultwhere default couldn't be overridden when content was passed as a block. - Fix bug where request-aware helpers didn't work outside of the request context.
ViewComponentsSystemTestControllershouldn't be useable outside of test environment
Non-functional changes
- Remove unnecessary usage of
ruby2_keywords. - Remove unnecessary
respond_tochecks. - Require MFA when publishing to RubyGems.
- Clean up project dependencies, relaxing versions of development gems.
- Add test case for absolute URL path helpers in mailers.
- Update documentation on performance to reflect more representative benchmark showing 2-3x speed increase over partials.
- Add documentation note about instrumentation negatively affecting performance.
- Remove unnecessary ENABLE_RELOADING test suite flag.
config.previews.default_layoutshould default to nil.- Add test coverage for uncovered code.
- Test against
turbo-railsv2andrspec-railsv7.
4.0.0.alpha7
-
BREAKING: Remove deprecated
use_helper(s). Useinclude MyHelperorhelpers.proxy instead.Joel Hawksley
-
BREAKING: Support compatibility with
Dry::Initializer. As a result,EmptyOrInvalidInitializerErrorwill no longer be raised.Joel Hawksley
-
BREAKING: Rename
config.generate.component_parent_classtoconfig.generate.parent_class.Joel Hawksley
-
Fix bug where
config.previews.enableddid not function properly in production environments.Joel Hawksley
-
config.previews.default_layoutshould default to nil.Joel Hawksley
-
Add test case for absolute URL path helpers in mailers.
Joel Hawksley
-
Fix bug where response format wasn't set, which caused issues with Turbo Frames.
Joel Hawksley
4.0.0.alpha6
-
BREAKING: Remove
config.test_controllerin favor ofvc_test_controller_classtest helper method.Joel Hawksley
-
BREAKING:
config.component_parent_classis nowconfig.generate.component_parent_class, moving the generator-specific option to the generator configuration namespace.Joel Hawksley
-
BREAKING: Move previews-related configuration (
enabled,route,paths,default_layout,controller) to underpreviewsnamespace.Joel Hawksley
-
Add template annotations for components with
def call.Joel Hawksley
-
Add support for including Turbo::StreamsHelper.
Stephen Nelson
-
Update documentation on performance to reflect more representative benchmark showing 2-3x speed increase over partials.
Joel Hawksley
-
Add documentation note about instrumentation negatively affecting performance.
Joel Hawksley
-
Revert object shapes optimization due to lack of evidence of improvement.
Joel Hawksley
v3.23.2
-
Include .tt files in published gem. Fixes templates not being available when using generators.
Florian Aßmann
v3.23.1
-
Restore Rake tasks in published gem.
Franz Liedke
v3.23.0
-
Add docs about Slack channel in Ruby Central workspace. (Join us! #oss-view-component). Email [email protected] for an invite.
*Joel Hawksley
-
Do not include internal
DocsBuilderComponentorYARD::MattrAccessorHandlerin published gem.Joel Hawksley
-
Only lock to
concurrent-ruby1.3.4for Rails 6.1.Joel Hawksley
-
Fix generation of ViewComponent documentation that was broken due to HTML safety issues.
Simon Fish
-
Add documentation on how ViewComponent works.
Joel Hawksley
-
Clarify that
config.use_deprecated_instrumentation_namewill be removed in v4.Joel Hawksley
-
Run RSpec tests in CI.
Joel Hawksley
4.0.0.alpha5
-
BREAKING:
config.view_component_pathis nowconfig.generate.path, as components have long since been able to exist in any directory.Joel Hawksley
-
BREAKING: Remove broken integration with
rails statsthat ignored components outside ofapp/components.Joel Hawksley
-
Add internal optimization for Ruby object shapes.
Adam Hess, Joel Hawksley
4.0.0.alpha4
-
BREAKING: Remove default initializer from
ViewComponent::Base. Previously,ViewComponent::Basedefined a catch-all initializer that allowed components without an initializer defined to be passed arbitrary arguments.Joel Hawksley
-
Graduate
SlotableDefaultto be included by default.Joel Hawksley
-
Fix bug in
SlotableDefaultwhere default couldn't be overridden when content was passed as a block.Bill Watts, Joel Hawksley
4.0.0.alpha3
-
BREAKING: Remove dependency on
ActionView::Base, eliminating the need for capture compatibility patch.Cameron Dutro
4.0.0.alpha2
-
Add
#current_templateaccessor andTemplate#pathfor diagnostic usage.Joel Hawksley