Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/view_component/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def template_errors

errors << "Couldn't find a template file or inline render method for #{@component}." if @templates.empty?

@templates
# Only check templates defined on this component or template files (not inherited inline calls)
# to allow component inheritance where child has template file and parent has inline render
templates_to_check = @templates.select { |t| !t.inline_call? || t.defined_on_self? }

templates_to_check
.map { |template| [template.variant, template.format] }
.tally
.select { |_, count| count > 1 }
Expand Down
Loading