Open dmarcoux opened 2 years ago
@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
would love to have this - would this be done via output_postamble and output_preamble?
@joevandyk yes, I think we'd do it in that area of the codebase! Happy to pair with you if you'd like, email me with your availability if you'd like: joelhawksley@github.com
I am using view_component in a Rails application with
config.action_view.annotate_rendered_view_with_filenames
set totrue
. For view components with templates, the HTML is annotated with the usualBEGIN
andEND
. However for inline components (so relying oncall
and not having a template), the HTML doesn't contain those annotations.Steps to reproduce
config.action_view.annotate_rendered_view_with_filenames
set totrue
in your Rails config.BEGIN
andEND
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 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