Skip to content

Conversation

lucasgeron
Copy link

@lucasgeron lucasgeron commented Oct 2, 2025

What are you trying to accomplish?

  • Fix wrong docs related to setting up a default layout for preview components.
  • Fix some lint offenses.

What approach did you choose and why?

  • Explore the configuration structure with Rails.application.config.view_component and notice that the documentation configuration is not working properly.

Before:

# with config.view_component.default_preview_layout = "component_preview"
{:generate=>{...},
 :previews=>
  {:controller=>"ViewComponentsController",
   :route=>"/rails/view_components",
   :enabled=>true,
   :default_layout=>nil, # value as nil
   :paths=>[...]},
 :instrumentation_enabled=>false}

After:

# with config.view_component.previews.default_layout = "Component_preview"
{:generate=>{...},
:previews=>
 {:controller=>"ViewComponentsController",
  :route=>"/rails/view_components",
  :enabled=>true,
  :default_layout=>"component_preview", # correct value
  :paths=>[...]},
:instrumentation_enabled=>false}

Anything you want to highlight for special attention from reviewers?

  • Is required to review if the current config.view_component.default_preview_layout is still in use or should it be removed.

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

Successfully merging this pull request may close these issues.

1 participant