Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-readers-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': minor
---

Enable use_experimental_non_local_form for all SelectPanels
14 changes: 5 additions & 9 deletions app/components/primer/alpha/select_panel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ def with_avatar_item(**system_arguments)
# @param dynamic_aria_label_prefix [String] If provided, the prefix is prepended to the dynamic label and set as the value of the `aria-label` attribute on the show button.
# @param body_id [String] The unique ID of the panel body. If not provided, the body ID will be set to the panel ID with a "-body" suffix.
# @param list_arguments [Hash] Arguments to pass to the underlying <%= link_to_component(Primer::Alpha::ActionList) %> component. Only has an effect for the local fetch strategy.
# @param form_arguments [Hash] Form arguments. Supported for `local`, and experimentally supported for `remote` and `eventually_local` strategies by enabling the `use_experimental_non_local_form` flag.
# @param use_experimental_non_local_form [Boolean] A feature flag used to slowly roll out moving the input field (generated from form arguments) to the top of the SelectPanel HTML thus allowing remote fetching to have default form values. At this time, support is only available for the :single select variant. See: https://github.com/github/primer/issues/4923.
# @param form_arguments [Hash] Form arguments. Supported for all fetch strategies.
# @param show_filter [Boolean] Whether or not to show the filter input.
# @param open_on_load [Boolean] Open the panel when the page loads.
# @param anchor_align [Symbol] The anchor alignment of the Overlay. <%= one_of(Primer::Alpha::Overlay::ANCHOR_ALIGN_OPTIONS) %>
Expand All @@ -377,7 +376,6 @@ def initialize(
dynamic_label_prefix: nil,
dynamic_aria_label_prefix: nil,
body_id: nil,
use_experimental_non_local_form: false,
list_arguments: {},
form_arguments: {},
show_filter: true,
Expand Down Expand Up @@ -411,13 +409,11 @@ def initialize(
@loading_label = loading_label
@loading_description_id = nil

if use_experimental_non_local_form
@form_builder = form_arguments[:builder]
@value = form_arguments[:value]
@input_name = form_arguments[:name]
end
@form_builder = form_arguments[:builder]
@value = form_arguments[:value]
@input_name = form_arguments[:name]
Comment on lines +412 to +414

Copilot AI Oct 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the removal of the conditional check, these form argument assignments will now execute for all SelectPanel instances. Consider adding validation to ensure form_arguments contains the expected keys when they are being accessed, to prevent potential nil assignment issues.

Suggested change
@form_builder = form_arguments[:builder]
@value = form_arguments[:value]
@input_name = form_arguments[:name]
form_arguments = form_arguments || {}
@form_builder = form_arguments.key?(:builder) ? form_arguments[:builder] : nil
@value = form_arguments.key?(:value) ? form_arguments[:value] : nil
@input_name = form_arguments.key?(:name) ? form_arguments[:name] : nil

Copilot uses AI. Check for mistakes.

@list_form_arguments = use_experimental_non_local_form ? {} : form_arguments
@list_form_arguments = {}

if loading_description.present?
@loading_description_id = "#{@panel_id}-loading-description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
open_on_load: open_on_load,
dynamic_label: true,
dynamic_label_prefix: "Item",
use_experimental_non_local_form: true,
form_arguments: {
name: :item,
builder: builder,
Expand Down
8 changes: 1 addition & 7 deletions static/arguments.json
Original file line number Diff line number Diff line change
Expand Up @@ -2502,13 +2502,7 @@
"name": "form_arguments",
"type": "Hash",
"default": "`{}`",
"description": "Form arguments. Supported for `local`, and experimentally supported for `remote` and `eventually_local` strategies by enabling the `use_experimental_non_local_form` flag."
},
{
"name": "use_experimental_non_local_form",
"type": "Boolean",
"default": "`false`",
"description": "A feature flag used to slowly roll out moving the input field (generated from form arguments) to the top of the SelectPanel HTML thus allowing remote fetching to have default form values. At this time, support is only available for the :single select variant. See: https://github.com/github/primer/issues/4923."
"description": "Form arguments. Supported for all fetch strategies."
},
{
"name": "show_filter",
Expand Down
8 changes: 1 addition & 7 deletions static/info_arch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7358,13 +7358,7 @@
"name": "form_arguments",
"type": "Hash",
"default": "`{}`",
"description": "Form arguments. Supported for `local`, and experimentally supported for `remote` and `eventually_local` strategies by enabling the `use_experimental_non_local_form` flag."
},
{
"name": "use_experimental_non_local_form",
"type": "Boolean",
"default": "`false`",
"description": "A feature flag used to slowly roll out moving the input field (generated from form arguments) to the top of the SelectPanel HTML thus allowing remote fetching to have default form values. At this time, support is only available for the :single select variant. See: https://github.com/github/primer/issues/4923."
"description": "Form arguments. Supported for all fetch strategies."
},
{
"name": "show_filter",
Expand Down
Loading