view_component 4.10.0 → 4.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af6c301478d5448d3784a0dd502e0baee242ee766a48aa0a9615aa1612bd9ceb
4
- data.tar.gz: e58be6763cb626c356f002a87d354297471eed752a912315b5fcd885f66b5652
3
+ metadata.gz: 13c7279c5aed2ac93503d70cfddae8b183b91c8a4ca0770a237d0b5aa081036c
4
+ data.tar.gz: 5fd930eb6b28a01da1152fd7d4a09e8019de0902f0508e4ea6aa0f23d6c584bd
5
5
  SHA512:
6
- metadata.gz: 58728c661bc715b65307ecce22fcd97552be486e788be3e3fedd7f308c214ab318d5a92fdf71c43330f376b134c0c6ae4f3588f1e3685eb0796aa7fead47da8e
7
- data.tar.gz: 845b3ffbd2fcfe4732f0970867568de978152a2fc3360b8b8b0d2038ee3dc03df0b7e0784e3cefc9b96c5cc57672fe56e5917ce7f072efd4f68c218cd843cc6d
6
+ metadata.gz: d691402cf227340f287c804e6a0ce639928ca2d409dd745701eae63dba20abdae2d3b876fb6d2c81d8b63f3a4ba9b0af7aa4268da5faf37c2fff5f3f7aa9b7ee
7
+ data.tar.gz: f9a554a6d53d75875c9863a1dedba3e6a51efd134e35dd43f5eb2883e446d5cab2ecba06f9a1fddd7e81d8e046aa5d0383585d9563f12897b4530606e225906c
data/docs/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@ nav_order: 6
10
10
 
11
11
  ## main
12
12
 
13
+ ## 4.11.0
14
+
15
+ * Update `render_in` signature to accept `**_` for compatibility with Rails [#50623](https://github.com/rails/rails/pull/50623).
16
+
17
+ *Joel Hawksley*
18
+
19
+ * Fix translation scope resolution in nested lambda-backed slots. Relative `t(".key")` calls inside lambda-backed slots were resolving against an intermediate component's scope instead of the original partial's scope where the block was defined.
20
+
21
+ *Artin Boghosian*
22
+
13
23
  ## 4.10.0
14
24
 
15
25
  * Fix `NameError: uninitialized constant ViewComponent::SystemTestControllerNefariousPathError` when booting in the test environment with `eager_load = true`.
@@ -103,7 +103,7 @@ module ViewComponent
103
103
  # Returns HTML that has been escaped by the respective template handler.
104
104
  #
105
105
  # @return [String]
106
- def render_in(view_context, &block)
106
+ def render_in(view_context, **_, &block)
107
107
  self.class.__vc_compile(raise_errors: true)
108
108
 
109
109
  @view_context = view_context
@@ -10,7 +10,7 @@ module ViewComponent
10
10
 
11
11
  delegate :size, to: :@collection
12
12
 
13
- def render_in(view_context, &block)
13
+ def render_in(view_context, **_, &block)
14
14
  components.map do |component|
15
15
  component.render_in(view_context, &block)
16
16
  end.join(rendered_spacer(view_context)).html_safe
@@ -8,7 +8,7 @@ module ViewComponent # :nodoc:
8
8
  mod.prepend(self) unless self <= ViewComponent::Instrumentation
9
9
  end
10
10
 
11
- def render_in(view_context, &block)
11
+ def render_in(view_context, **_, &block)
12
12
  return super if !Rails.application.config.view_component.instrumentation_enabled.present?
13
13
 
14
14
  payload = {
@@ -380,6 +380,7 @@ module ViewComponent
380
380
  def __vc_set_slot(slot_name, slot_definition = nil, *args, **kwargs, &block)
381
381
  slot_definition ||= self.class.registered_slots[slot_name]
382
382
  slot = Slot.new(self)
383
+ captured_block_virtual_path = nil
383
384
 
384
385
  # Passing the block to the sub-component wrapper like this has two
385
386
  # benefits:
@@ -394,7 +395,8 @@ module ViewComponent
394
395
  slot.__vc_content_block = block
395
396
  # Capture the virtual path at the time the block is defined, so that
396
397
  # translations resolve relative to where the block was created, not where it's rendered
397
- slot.__vc_content_block_virtual_path = view_context.instance_variable_get(:@virtual_path)
398
+ captured_block_virtual_path = view_context.instance_variable_get(:@virtual_path)
399
+ slot.__vc_content_block_virtual_path = captured_block_virtual_path
398
400
  end
399
401
 
400
402
  # If class
@@ -413,7 +415,7 @@ module ViewComponent
413
415
  renderable_value =
414
416
  if block
415
417
  renderable_function.call(*args, **kwargs) do |*rargs|
416
- with_captured_virtual_path(@old_virtual_path) do
418
+ with_captured_virtual_path(captured_block_virtual_path) do
417
419
  view_context.capture(*rargs, &block)
418
420
  end
419
421
  end
@@ -3,7 +3,7 @@
3
3
  module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 4
6
- MINOR = 10
6
+ MINOR = 11
7
7
  PATCH = 0
8
8
  PRE = nil
9
9
 
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.10.0
4
+ version: 4.11.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.6
138
+ rubygems_version: 4.0.10
139
139
  specification_version: 4
140
140
  summary: A framework for building reusable, testable & encapsulated view components
141
141
  in Ruby on Rails.