I am using view_component in a Rails application with config.action_view.annotate_rendered_view_with_filenames set to true. For view components with templates, the HTML is annotated with the usual BEGIN and END. However for inline components (so relying on call and not having a template), the HTML doesn't contain those annotations.
Steps to reproduce
Set config.action_view.annotate_rendered_view_with_filenames set to true in your Rails config.
Render a view component with a template.
Render an inline view component.
See the BEGIN and END comments for the view component with a template, but not for the inline view component.
Example in which the <abbr> tag is an inline view component and another component with a template which renders Hello!:
Expected behavior
I expect the annotations to be added for inline view components.
Actual behavior
The annotations are not added for inline view components.
@dmarcoux thanks for filing this issue! The current implementation of template annotations hooks into the template compilation process, which isn't used for inline components.
I'd love to see this feature added to the framework, would you like to take it on? I'd be happy to pair with you to get it off the ground: joelhawksley@github.com
I am using view_component in a Rails application with
config.action_view.annotate_rendered_view_with_filenamesset totrue. For view components with templates, the HTML is annotated with the usualBEGINandEND. However for inline components (so relying oncalland not having a template), the HTML doesn't contain those annotations.Steps to reproduce
config.action_view.annotate_rendered_view_with_filenamesset totruein your Rails config.BEGINandENDcomments for the view component with a template, but not for the inline view component.Example in which the

<abbr>tag is an inline view component and another component with a template which rendersHello!:Expected behavior
I expect the annotations to be added for inline view components.
Actual behavior
The annotations are not added for inline view components.
System configuration
Rails version: Rails 7.0.2.2
Ruby version: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]
Gem version: 2.49.1
The text was updated successfully, but these errors were encountered: