Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Jul 20, 2023
1 parent d384cfe commit 619b299
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/view_component/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def render_parent
target_render = self.class.instance_variable_get(:@__vc_ancestor_calls).reverse[@__vc_parent_render_level]
@__vc_parent_render_level += 1

target_render.bind_call(self)
capture { target_render.bind_call(self, @__vc_variant) }
ensure
@__vc_parent_render_level -= 1
end
Expand Down
4 changes: 3 additions & 1 deletion lib/view_component/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def render_template_for(variant = nil)
else
templates.each do |template|
method_name = call_method_name(template[:variant])

redefinition_lock.synchronize do
component_class.silence_redefinition_of_method(method_name)
# rubocop:disable Style/EvalWithLocation
Expand Down Expand Up @@ -141,7 +141,9 @@ def methodize(str)
end

def define_render_template_for
# puts component_class
variant_elsifs = variants.compact.uniq.map do |variant|
# binding.irb if component_class == Level3Component
safe_name = "_call_variant_#{normalized_variant_name(variant)}_#{component_class.name.underscore}"
component_class.define_method("_call_variant_#{normalized_variant_name(variant)}_#{component_class.name.underscore}", component_class.instance_method(call_method_name(variant)))

Expand Down

0 comments on commit 619b299

Please sign in to comment.