Skip to content

fix outdated settings related to default layout preview - #2450

Merged
joelhawksley merged 11 commits into
ViewComponent:mainfrom
lucasgeron:patch-1
Dec 3, 2025
Merged

joelhawksley merged 11 commits into
ViewComponent:mainfrom
lucasgeron:patch-1

Conversation

@lucasgeron

@lucasgeron lucasgeron commented Oct 2, 2025 •

Copy link
Copy Markdown
Contributor

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.

@Spone
Spone requested a review from finalburn October 27, 2025 08:43
@Spone

Spone commented Oct 27, 2025

Copy link
Copy Markdown
Collaborator

@boardfish mind reviewing this? 🙏

Comment thread docs/CHANGELOG.md Outdated
Comment thread docs/CHANGELOG.md Outdated
@joelhawksley
joelhawksley merged commit c54ee6b into ViewComponent:main Dec 3, 2025
12 of 13 checks passed
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.

3 participants