fix(ui): allow selectinputs to reset to their initial values if theres no provided value (#11252)

When reusing the SelectInput component from the UI package, if you set
value to `''` it will continue to display the previously selected value
instead of clearing out the field as expected.

The ReactSelect component doesn't behave in this way and instead will
clear out the field.

This fix addresses this difference by resetting `valueToRender` inside
the SelectInput to null.
This commit is contained in:
Paul
2025-02-18 16:40:29 +00:00
committed by GitHub
parent 313ff047df
commit 1c4eba41b7
5 changed files with 99 additions and 10 deletions

View File

@@ -334,6 +334,7 @@ export interface CustomField {
descriptionAsFunction?: string | null;
descriptionAsComponent?: string | null;
customSelectField?: string | null;
customSelectInput?: string | null;
relationshipFieldWithBeforeAfterInputs?: (string | null) | Post;
arrayFieldWithBeforeAfterInputs?:
| {
@@ -717,6 +718,7 @@ export interface CustomFieldsSelect<T extends boolean = true> {
descriptionAsFunction?: T;
descriptionAsComponent?: T;
customSelectField?: T;
customSelectInput?: T;
relationshipFieldWithBeforeAfterInputs?: T;
arrayFieldWithBeforeAfterInputs?:
| T