view_component 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +21 -1
- data/lib/view_component/base.rb +2 -0
- data/lib/view_component/engine.rb +5 -1
- data/lib/view_component/template.rb +7 -0
- data/lib/view_component/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cd32d6d38604882019810f1213145bafb749c66b57d4edcee32902092f436ab
|
|
4
|
+
data.tar.gz: c29d17a4f72223b7e342e5f224fc39505d3bc50cb1a8174db6371c6d6b8ded6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aecaee657c788ae3395994d2234711101fc58f5439f9488993e9b928cb103abba5f5add66d53719259c4f6069a661b7e0a2c3a96ce3c990ca1191fa92b2933fd
|
|
7
|
+
data.tar.gz: 87688cbcfeb6a50be556a435b97e0ff6541fdb4383589b24971c7a6c0caee61d506acee766da36b76345d780cdb0877a6ebff3fb4965c1cb7d1b2878f65e4aab
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,26 @@ nav_order: 6
|
|
|
10
10
|
|
|
11
11
|
## main
|
|
12
12
|
|
|
13
|
+
## 4.8.0
|
|
14
|
+
|
|
15
|
+
* Add `compile.view_component` ActiveSupport::Notifications event for eager compilation at boot time.
|
|
16
|
+
|
|
17
|
+
*Joel Hawksley*, *GitHub Copilot*
|
|
18
|
+
|
|
19
|
+
## 4.7.0
|
|
20
|
+
|
|
21
|
+
* Fix stale content cache when slots are accessed before `render_in`.
|
|
22
|
+
|
|
23
|
+
*Jared Armstrong*
|
|
24
|
+
|
|
25
|
+
* Add rubocop-view_component to resources.
|
|
26
|
+
|
|
27
|
+
*Andy Waite*
|
|
28
|
+
|
|
29
|
+
* Fix bug where inheritance of components with formatless templates improperly raised a NoMethodError.
|
|
30
|
+
|
|
31
|
+
*GitHub Copilot*, *Joel Hawksley*, *Cameron Dutro*
|
|
32
|
+
|
|
13
33
|
## 4.6.0
|
|
14
34
|
|
|
15
35
|
* Add `view_identifier` to the `render.view_component` instrumentation event payload, containing the path to the component's template file (e.g. `app/components/my_component.html.erb`). For components using inline render methods, `view_identifier` will be `nil`.
|
|
@@ -22,7 +42,7 @@ nav_order: 6
|
|
|
22
42
|
|
|
23
43
|
* Return `html_safe` empty string from `render_in` when `render?` is false.
|
|
24
44
|
|
|
25
|
-
*Copilot*
|
|
45
|
+
*GitHub Copilot*
|
|
26
46
|
|
|
27
47
|
## 4.5.0
|
|
28
48
|
|
data/lib/view_component/base.rb
CHANGED
|
@@ -131,6 +131,7 @@ module ViewComponent
|
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
@__vc_content_evaluated = false
|
|
134
|
+
remove_instance_variable(:@__vc_content) if defined?(@__vc_content)
|
|
134
135
|
@__vc_render_in_block = block
|
|
135
136
|
@view_context.instance_variable_set(:@virtual_path, virtual_path)
|
|
136
137
|
|
|
@@ -517,6 +518,7 @@ module ViewComponent
|
|
|
517
518
|
# @param extensions [Array<String>] Extensions of which to return matching sidecar files.
|
|
518
519
|
def sidecar_files(extensions)
|
|
519
520
|
return [] unless identifier
|
|
521
|
+
return [] unless name
|
|
520
522
|
|
|
521
523
|
extensions = extensions.join(",")
|
|
522
524
|
|
|
@@ -79,7 +79,11 @@ module ViewComponent
|
|
|
79
79
|
|
|
80
80
|
initializer "view_component.eager_load_actions" do
|
|
81
81
|
ActiveSupport.on_load(:after_initialize) do
|
|
82
|
-
|
|
82
|
+
if Rails.application.config.eager_load
|
|
83
|
+
ActiveSupport::Notifications.instrument("compile.view_component") do
|
|
84
|
+
ViewComponent::Base.descendants.each(&:__vc_compile)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
83
87
|
end
|
|
84
88
|
end
|
|
85
89
|
|
|
@@ -21,6 +21,13 @@ module ViewComponent
|
|
|
21
21
|
|
|
22
22
|
class File < Template
|
|
23
23
|
def initialize(component:, details:, path:)
|
|
24
|
+
# If the template file has no format (e.g. .erb instead of .html.erb),
|
|
25
|
+
# assume the default format (html).
|
|
26
|
+
if details.format.nil?
|
|
27
|
+
Kernel.warn("WARNING: Template format for #{path} is missing, defaulting to :html.")
|
|
28
|
+
details = ActionView::TemplateDetails.new(details.locale, details.handler, DEFAULT_FORMAT, details.variant)
|
|
29
|
+
end
|
|
30
|
+
|
|
24
31
|
@strip_annotation_line = false
|
|
25
32
|
|
|
26
33
|
# Rails 8.1 added a newline to compiled ERB output (rails/rails#53731).
|