Skip to content

Commit ae97b00

Browse files
authored
Merge pull request #2363 from ViewComponent/v4.0.0.rc1
V4.0.0.rc1
2 parents 756a322 + 425f607 commit ae97b00

File tree

4 files changed

+70
-7
lines changed

4 files changed

+70
-7
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
view_component (4.0.0.alpha7)
4+
view_component (4.0.0.rc1)
55
activesupport (>= 7.1.0, < 8.1)
66
concurrent-ruby (~> 1)
77

docs/CHANGELOG.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,80 @@ nav_order: 6
1010

1111
## main
1212

13-
* Require MFA when publishing to RubyGems.
13+
## 4.0.0.rc1
1414

15-
*Joel Hawksley*
15+
Almost six years after releasing [v1.0.0](https://github.com/ViewComponent/view_component/releases/tag/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.
16+
17+
Please report any issues at [https://github.com/ViewComponent/view_component/issues](https://github.com/ViewComponent/view_component/issues).
18+
19+
### Breaking changes (production)
20+
21+
* Remove dependency on `ActionView::Base`, eliminating the need for capture compatibility patch. In some edge cases, this change may require switching to use the `helpers.` proxy.
22+
* Require [non-EOL](https://endoflife.date/rails) Rails (`>= 7.1.0`) and Ruby (`>= 3.2.0`).
23+
* Remove `render_component` and `render` monkey patch configured with `render_monkey_patch_enabled`.
24+
* Remove deprecated `use_helper(s)`. Use `include MyHelper` or `helpers.` proxy instead.
25+
* Support compatibility with `Dry::Initializer`. As a result, `EmptyOrInvalidInitializerError` will no longer be raised.
26+
* Remove default initializer from `ViewComponent::Base`. Previously, `ViewComponent::Base` defined a catch-all initializer that allowed components without an initializer defined to be passed arbitrary arguments.
27+
* Remove `use_deprecated_instrumentation_name` configuration option. Events will always use `render.view_component` name.
28+
* Remove unnecessary `#format` methods that returned `nil`.
29+
* Remove support for variant names containing `.` to be consistent with Rails.
30+
* Rename internal methods to have `__vc_` prefix if they shouldn't be used by consumers. Make internal constants private. Make `Collection#components`, `Slotable#register_polymorphic_slot` private. Remove unused `ComponentError` class.
31+
* Use ActionView's `lookup_context` for picking templates instead of the request format.
32+
33+
3.15 added support for using templates that match the request format, i.e. if `/resource.csv` is requested then
34+
ViewComponents would pick `_component.csv.erb` over `_component.html.erb`.
35+
36+
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, i.e. the csv template will be used if it matches the `Accept` header or because the controller uses a `respond_to` block to pick the response format.
37+
38+
### Breaking changes (dev/test)
39+
40+
* Rename `config.generate.component_parent_class` to `config.generate.parent_class`.
41+
* Remove `config.test_controller` in favor of `vc_test_controller_class` test helper method.
42+
* `config.component_parent_class` is now `config.generate.component_parent_class`, moving the generator-specific option to the generator configuration namespace.
43+
* Move previews-related configuration (`enabled`, `route`, `paths`, `default_layout`, `controller`) to under `previews` namespace.
44+
* `config.view_component_path` is now `config.generate.path`, as components have long since been able to exist in any directory.
45+
* `--inline` generator option now generates inline template. Use `--call` to generate `#call` method.
46+
* Remove broken integration with `rails stats` that ignored components outside of `app/components`.
47+
* Remove `preview_source` functionality. Consider using [Lookbook](https://lookbook.build/) instead.
48+
* Use `Nokogiri::HTML5` instead of `Nokogiri::HTML4` for test helpers.
49+
* Move generators to a ViewComponent namespace.
50+
51+
Before, ViewComponent generators pollute the generator namespace with a bunch of top level items, and claim the generic "component" name.
52+
53+
Now, generators live in a "view_component" module/namespace, so what was before `rails g
54+
component` is now `rails g view_component:component`.
55+
56+
### New features
1657

1758
* Add `SystemSpecHelpers` for use with RSpec.
59+
* Add support for including `Turbo::StreamsHelper`.
60+
* Add template annotations for components with `def call`.
61+
* Graduate `SlotableDefault` to be included by default.
62+
* Add `#current_template` accessor and `Template#path` for diagnostic usage.
63+
* Reduce string allocations during compilation.
1864

19-
*Meyric Rawlings*, *Joel Hawksley*
65+
### Bug fixes
2066

2167
* Fix bug where virtual path wasn't reset, breaking translations outside of components.
68+
* Fix bug where `config.previews.enabled` did not function properly in production environments.
69+
* Fix bug where response format wasn't set, which caused issues with Turbo Frames.
70+
* Fix bug in `SlotableDefault` where default couldn't be overridden when content was passed as a block.
71+
* Fix bug where request-aware helpers did not work outside of the request context.
72+
* `ViewComponentsSystemTestController` should not be useable outside of test environment
2273

23-
*Alex Coles*, *Joel Hawksley*
74+
### Non-functional changes
75+
76+
* Remove unnecessary usage of `ruby2_keywords`.
77+
* Remove unnecessary `respond_to` checks.
78+
* Require MFA when publishing to RubyGems.
79+
* Clean up project dependencies, relaxing versions of development gems.
80+
* Add test case for absolute URL path helpers in mailers.
81+
* Update documentation on performance to reflect more representative benchmark showing 2-3x speed increase over partials.
82+
* Add documentation note about instrumentation negatively affecting performance.
83+
* Remove unnecessary ENABLE_RELOADING test suite flag.
84+
* `config.previews.default_layout` should default to nil.
85+
* Add test coverage for uncovered code.
86+
* Test against `turbo-rails` `v2` and `rspec-rails` `v7`.
2487

2588
## 4.0.0.alpha7
2689

lib/view_component/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module VERSION
55
MAJOR = 4
66
MINOR = 0
77
PATCH = 0
8-
PRE = "alpha7"
8+
PRE = "rc1"
99

1010
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
1111
end

script/replicate-bug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bundle add view_component --git https://github.com/viewcomponent/view_component
1212
# Generate a controller
1313
rails g controller Home index
1414
# Generate ApplicationComponent, assuming most folks use it.
15-
rails g component ApplicationComponent --template_engine=no_template
15+
rails g view_component ApplicationComponent --template_engine=no_template
1616
# Root to the index action on HomeController
1717
cat << 'ROUTES' > 'config/routes.rb'
1818
Rails.application.routes.draw do

0 commit comments

Comments
 (0)