diff --git a/lib/view_component/compiler.rb b/lib/view_component/compiler.rb index da557c39e..2dc2eda8c 100644 --- a/lib/view_component/compiler.rb +++ b/lib/view_component/compiler.rb @@ -26,7 +26,7 @@ def compile(raise_errors: false, force: false) gather_templates - if self.class.development_mode && @templates.none? { !(_1.inline_call? && !_1.defined_on_self?) } + if self.class.development_mode && @templates.any?(&:requires_compiled_superclass?) @component.superclass.compile(raise_errors: raise_errors) end @@ -259,6 +259,10 @@ def #{@call_method_name} @component.define_method(safe_method_name, @component.instance_method(@call_method_name)) end + def requires_compiled_superclass? + inline_call? && !defined_on_self? + end + def inline_call? @type == :inline_call end