view_component 4.5.0 → 4.6.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 +14 -0
- data/lib/view_component/base.rb +1 -1
- data/lib/view_component/instrumentation.rb +18 -5
- data/lib/view_component/preview.rb +1 -1
- data/lib/view_component/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 761d9451b4af2b617182339d3a356985d119be9ff490018815d9affd6ede89dc
|
|
4
|
+
data.tar.gz: 508b8e0699e11bbed4f649cebc9df0015e08e45b1cf92c1c528f13d566422c79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4820e68ab750d1c89901c2244527e8896d42a270afb20d8add4c0437fab80d7f4623e9da3817baafda390d94c77c0d5e79959f95772fedc571b132565fcd8bca
|
|
7
|
+
data.tar.gz: 1a3118de2ce98910b40ba370b13618083c396565a7b2db128eea39de7263c2d17240865caf2f94c7e83ee9113537cd5d18f6b6c3c80e137d5f5e15f1f823ba17
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,20 @@ nav_order: 6
|
|
|
10
10
|
|
|
11
11
|
## main
|
|
12
12
|
|
|
13
|
+
## 4.6.0
|
|
14
|
+
|
|
15
|
+
* 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`.
|
|
16
|
+
|
|
17
|
+
*GitHub Copilot*
|
|
18
|
+
|
|
19
|
+
* Replace deprecated `require_dependency` with `require` in preview loading.
|
|
20
|
+
|
|
21
|
+
*GitHub Copilot*
|
|
22
|
+
|
|
23
|
+
* Return `html_safe` empty string from `render_in` when `render?` is false.
|
|
24
|
+
|
|
25
|
+
*Copilot*
|
|
26
|
+
|
|
13
27
|
## 4.5.0
|
|
14
28
|
|
|
15
29
|
* Fix initialization ordering issue causing missing asset errors in Sprockets.
|
data/lib/view_component/base.rb
CHANGED
|
@@ -11,15 +11,28 @@ module ViewComponent # :nodoc:
|
|
|
11
11
|
def render_in(view_context, &block)
|
|
12
12
|
return super if !Rails.application.config.view_component.instrumentation_enabled.present?
|
|
13
13
|
|
|
14
|
+
payload = {
|
|
15
|
+
name: self.class.name,
|
|
16
|
+
identifier: self.class.identifier,
|
|
17
|
+
view_identifier: nil
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
ActiveSupport::Notifications.instrument(
|
|
15
21
|
"render.view_component",
|
|
16
|
-
|
|
17
|
-
name: self.class.name,
|
|
18
|
-
identifier: self.class.identifier
|
|
19
|
-
}
|
|
22
|
+
payload
|
|
20
23
|
) do
|
|
21
|
-
super
|
|
24
|
+
result = super
|
|
25
|
+
payload[:view_identifier] = @__vc_instrumentation_view_identifier
|
|
26
|
+
result
|
|
22
27
|
end
|
|
28
|
+
ensure
|
|
29
|
+
@__vc_instrumentation_view_identifier = nil
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def around_render
|
|
33
|
+
result = super
|
|
34
|
+
@__vc_instrumentation_view_identifier = current_template&.path
|
|
35
|
+
result
|
|
23
36
|
end
|
|
24
37
|
end
|
|
25
38
|
end
|
|
@@ -95,7 +95,7 @@ module ViewComponent # :nodoc:
|
|
|
95
95
|
# @private
|
|
96
96
|
def __vc_load_previews
|
|
97
97
|
Array(preview_paths).each do |preview_path|
|
|
98
|
-
Dir["#{preview_path}/**/*preview.rb"].sort.each { |file|
|
|
98
|
+
Dir["#{preview_path}/**/*preview.rb"].sort.each { |file| require file }
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: view_component
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ViewComponent Team
|
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
136
|
version: '0'
|
|
137
137
|
requirements: []
|
|
138
|
-
rubygems_version: 4.0.
|
|
138
|
+
rubygems_version: 4.0.6
|
|
139
139
|
specification_version: 4
|
|
140
140
|
summary: A framework for building reusable, testable & encapsulated view components
|
|
141
141
|
in Ruby on Rails.
|