Skip to content

Commit

Permalink
Merge pull request #558 from ViewComponent/fix-template-assigns
Browse files Browse the repository at this point in the history
Ensure `assigns` are handled correctly when rendering previews
  • Loading branch information
allmarkedup authored Nov 23, 2023
2 parents 044508a + 950f3f6 commit c978911
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/lookbook/preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def render(component = nil, **args, &block)
template: args[:template] || Lookbook.config.preview_template,
args: args,
locals: args[:locals] || {},
assigns: args[:assigns] || {},
block: block
}
else
Expand Down
1 change: 1 addition & 0 deletions lib/lookbook/preview_controller_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def render_scenario_to_string(preview, scenario)
locals = @render_args[:locals]
opts = {}
opts[:layout] = nil
opts[:assigns] = @render_args[:assigns] || {}
opts[:locals] = locals if locals.present?

rendered = render_to_string(template, **opts)
Expand Down

0 comments on commit c978911

Please sign in to comment.