Accept keyword arguments in render_in methods - #4091
Merged
Conversation
- Rails `main` now[1] deprecates renderable objects whose `render_in` method only accepts a single positional argument. The args don't have to be used, hence why they're `_` prefixed here: the arity check is very basic. - Uses of PrimerViewComponents in applications on Rails `main` were seeing ActionView deprecation warnings: ``` Change #render_in to accept keyword arguments. (called from block (2 levels) in FooComponent#call at app/components/foo_component.html.erb:8) DEPRECATION WARNING: Action View support for #render_in without options is deprecated. ``` [1]: rails/rails@4870c5f)
🦋 Changeset detectedLatest commit: 7aaac79 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates render_in method signatures across Primer components/forms to accept keyword arguments, aligning with Rails main’s deprecation of renderables whose render_in only accepts a single positional argument.
Changes:
- Add
**_kwargsto severalrender_inoverrides to satisfy Rails’ arity/kwargs expectations. - Update form-related renderables (
FormComponents,ToggleSwitchForm,ActsAsComponent) to accept keyword args. - Update TreeView and ButtonGroup internal components to accept keyword args in
render_in.
Show a summary per file
| File | Description |
|---|---|
| lib/primer/form_components.rb | Adjusts dynamically generated form component wrapper’s render_in to accept keyword args. |
| app/lib/primer/forms/toggle_switch_form.rb | Updates render_in override to accept keyword args while still building a builder at render time. |
| app/lib/primer/forms/acts_as_component.rb | Updates renderable mixin’s render_in signature to accept keyword args. |
| app/components/primer/beta/button_group.rb | Updates MenuButton#render_in signature to accept keyword args (but currently doesn’t forward them to super). |
| app/components/primer/alpha/tree_view/visual.rb | Updates TreeView visual wrapper render_in to accept keyword args. |
| app/components/primer/alpha/tree_view/sub_tree_node.rb | Updates subtree node render_in wrapper to accept keyword args. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 1
francinelucca
requested review from
jonrohan
and removed request for
francinelucca
June 12, 2026 01:53
Allow `render_in` methods to accept keyword arguments.
jonrohan
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authors: Please fill out this form carefully and completely.
Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.
What are you trying to accomplish?
mainnow deprecates renderable objects whoserender_inmethod only accepts a single positional argument. The args don't have to be used, hence why they're_prefixed here: the arity check is very basic.mainwere seeing ActionView deprecation warnings:Screenshots
N/A.
Integration
N/A.
List the issues that this change affects.
N/A (not linking the internal one).
Risk Assessment
- Building the gem from this branch locally fixed the deprecation warnings.
What approach did you choose and why?
Anything you want to highlight for special attention from reviewers?
N/A.
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.