Skip to content

Commit 40bde33

Browse files
authored
Merge branch 'main' into 2224-setup-trusted-publishing
2 parents 757f81c + 25f2c58 commit 40bde33

File tree

5 files changed

+87
-12
lines changed

5 files changed

+87
-12
lines changed

Gemfile.lock

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

@@ -317,7 +317,7 @@ GEM
317317
docile (~> 1.1)
318318
simplecov-html (~> 0.11)
319319
simplecov_json_formatter (~> 0.1)
320-
simplecov-console (0.9.3)
320+
simplecov-console (0.9.4)
321321
ansi
322322
simplecov
323323
terminal-table

docs/CHANGELOG.md

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,81 @@ nav_order: 6
1414

1515
*Hans Lemuet*
1616

17+
## 4.0.0
18+
19+
Two years after releasing [3.0.0](https://github.com/ViewComponent/view_component/releases/tag/v3.0.0) and almost six years since [1.0.0](https://github.com/ViewComponent/view_component/releases/tag/v1.0.0), we're proud to ship 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.
20+
21+
Please report any issues at [https://github.com/ViewComponent/view_component/issues](https://github.com/ViewComponent/view_component/issues).
22+
23+
### Breaking changes (production)
24+
25+
* 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.
26+
* Require [non-EOL](https://endoflife.date/rails) Rails (`>= 7.1.0`) and Ruby (`>= 3.2.0`).
27+
* Remove `render_component` and `render` monkey patch configured with `render_monkey_patch_enabled`.
28+
* Remove deprecated `use_helper(s)`. Use `include MyHelper` or `helpers.` proxy instead.
29+
* Support compatibility with `Dry::Initializer`. As a result, `EmptyOrInvalidInitializerError` will no longer be raised.
30+
* 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.
31+
* Remove `use_deprecated_instrumentation_name` configuration option. Events will always use `render.view_component` name.
32+
* Remove unnecessary `#format` methods that returned `nil`.
33+
* Remove support for variant names containing `.` to be consistent with Rails.
34+
* 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.
35+
* Use ActionView's `lookup_context` for picking templates instead of the request format.
36+
37+
3.15 added support for using templates that match the request format, that is if `/resource.csv` is requested then
38+
ViewComponents would pick `_component.csv.erb` over `_component.html.erb`.
39+
40+
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 `Accept` header or because the controller uses a `respond_to` block to pick the response format.
41+
42+
### Breaking changes (dev/test)
43+
44+
* Rename `config.generate.component_parent_class` to `config.generate.parent_class`.
45+
* Remove `config.test_controller` in favor of `vc_test_controller_class` test helper method.
46+
* `config.component_parent_class` is now `config.generate.component_parent_class`, moving the generator-specific option to the generator configuration namespace.
47+
* Move previews-related configuration (`enabled`, `route`, `paths`, `default_layout`, `controller`) to under `previews` namespace.
48+
* `config.view_component_path` is now `config.generate.path`, as components have long since been able to exist in any directory.
49+
* `--inline` generator option now generates inline template. Use `--call` to generate `#call` method.
50+
* Remove broken integration with `rails stats` that ignored components outside of `app/components`.
51+
* Remove `preview_source` functionality. Consider using [Lookbook](https://lookbook.build/) instead.
52+
* Use `Nokogiri::HTML5` instead of `Nokogiri::HTML4` for test helpers.
53+
* Move generators to a ViewComponent namespace.
54+
55+
Before, ViewComponent generators pollute the generator namespace with a bunch of top level items, and claim the generic "component" name.
56+
57+
Now, generators live in a "view_component" module/namespace, so what was before `rails g
58+
component` is now `rails g view_component:component`.
59+
60+
### New features
61+
62+
* Add `SystemSpecHelpers` for use with RSpec.
63+
* Add support for including `Turbo::StreamsHelper`.
64+
* Add template annotations for components with `def call`.
65+
* Graduate `SlotableDefault` to be included by default.
66+
* Add `#current_template` accessor and `Template#path` for diagnostic usage.
67+
* Reduce string allocations during compilation.
68+
* Add `around_render` lifecyle method for wrapping component rendering in custom instrumentation, etc.
69+
70+
### Bug fixes
71+
72+
* Fix bug where virtual path wasn't reset, breaking translations outside of components.
73+
* Fix bug where `config.previews.enabled` didn't function properly in production environments.
74+
* Fix bug in `SlotableDefault` where default couldn't be overridden when content was passed as a block.
75+
* Fix bug where request-aware helpers didn't work outside of the request context.
76+
* `ViewComponentsSystemTestController` shouldn't be useable outside of test environment
77+
78+
### Non-functional changes
79+
80+
* Remove unnecessary usage of `ruby2_keywords`.
81+
* Remove unnecessary `respond_to` checks.
82+
* Require MFA when publishing to RubyGems.
83+
* Clean up project dependencies, relaxing versions of development gems.
84+
* Add test case for absolute URL path helpers in mailers.
85+
* Update documentation on performance to reflect more representative benchmark showing 2-3x speed increase over partials.
86+
* Add documentation note about instrumentation negatively affecting performance.
87+
* Remove unnecessary ENABLE_RELOADING test suite flag.
88+
* `config.previews.default_layout` should default to nil.
89+
* Add test coverage for uncovered code.
90+
* Test against `turbo-rails` `v2` and `rspec-rails` `v7`.
91+
1792
## 4.0.0.rc5
1893

1994
* Revert change setting `#format`. In GitHub's codebase, the change led to hard-to-detect failures. For example, components rendered from controllers included layouts when they didn't before. In other cases, the response `content_type` changed, breaking downstream consumers. For cases where a specific content type is needed, use:
@@ -60,7 +135,7 @@ Almost six years after releasing [v1.0.0](https://github.com/ViewComponent/view_
60135

61136
Please report any issues at [https://github.com/ViewComponent/view_component/issues](https://github.com/ViewComponent/view_component/issues).
62137

63-
### Breaking changes (production)
138+
### 4.0.0.rc1 Breaking changes (production)
64139

65140
* 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.
66141
* Require [non-EOL](https://endoflife.date/rails) Rails (`>= 7.1.0`) and Ruby (`>= 3.2.0`).
@@ -79,7 +154,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
79154

80155
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 `Accept` header or because the controller uses a `respond_to` block to pick the response format.
81156

82-
### Breaking changes (dev/test)
157+
### 4.0.0.rc1 Breaking changes (dev/test)
83158

84159
* Rename `config.generate.component_parent_class` to `config.generate.parent_class`.
85160
* Remove `config.test_controller` in favor of `vc_test_controller_class` test helper method.
@@ -97,7 +172,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
97172
Now, generators live in a "view_component" module/namespace, so what was before `rails g
98173
component` is now `rails g view_component:component`.
99174

100-
### New features
175+
### 4.0.0.rc1 New features
101176

102177
* Add `SystemSpecHelpers` for use with RSpec.
103178
* Add support for including `Turbo::StreamsHelper`.
@@ -106,7 +181,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
106181
* Add `#current_template` accessor and `Template#path` for diagnostic usage.
107182
* Reduce string allocations during compilation.
108183

109-
### Bug fixes
184+
### 4.0.0.rc1 Bug fixes
110185

111186
* Fix bug where virtual path wasn't reset, breaking translations outside of components.
112187
* Fix bug where `config.previews.enabled` didn't function properly in production environments.
@@ -115,7 +190,7 @@ Please report any issues at [https://github.com/ViewComponent/view_component/iss
115190
* Fix bug where request-aware helpers didn't work outside of the request context.
116191
* `ViewComponentsSystemTestController` shouldn't be useable outside of test environment
117192

118-
### Non-functional changes
193+
### 4.0.0.rc1 Non-functional changes
119194

120195
* Remove unnecessary usage of `ruby2_keywords`.
121196
* Remove unnecessary `respond_to` checks.

docs/_data/library.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 4.0.0.rc5
1+
version: 4.0.0

docs/guide/previews.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ config.view_component.default_preview_layout = "component_preview"
115115

116116
## Preview paths
117117

118-
Preview classes live in `test/components/previews`, which can be configured using the `preview_paths` option:
118+
Preview classes live in `test/components/previews`, which can be configured using the `previews.paths` option:
119119

120120
```ruby
121121
# config/application.rb
@@ -210,9 +210,9 @@ config.view_component.previews.enabled = false
210210

211211
## Use with RSpec
212212

213-
When using previews with RSpec, replace `test/components` with `spec/components` and update `preview_paths`:
213+
When using previews with RSpec, replace `test/components` with `spec/components` and update `previews.paths`:
214214

215215
```ruby
216216
# config/application.rb
217-
config.view_component.preview_paths << "#{Rails.root}/spec/components/previews"
217+
config.view_component.previews.paths << "#{Rails.root}/spec/components/previews"
218218
```

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 = "rc5"
8+
PRE = nil
99

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

0 commit comments

Comments
 (0)