Sitelet https://web.archive.org/web/20220709112656/https://github.com/github/view_component/issues/1301
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations missing for inline components when annotate_rendered_view_with_filenames is enabled #1301

Open
dmarcoux opened this issue Mar 8, 2022 · 1 comment

Comments

@dmarcoux
Copy link
Contributor

@dmarcoux dmarcoux commented Mar 8, 2022

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

  1. Set config.action_view.annotate_rendered_view_with_filenames set to true in your Rails config.
  2. Render a view component with a template.
  3. Render an inline view component.
  4. 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!:
example

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

@joelhawksley
Copy link
Contributor

@joelhawksley joelhawksley commented Mar 9, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants