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
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
- `InputControl`: Vertically center the value of date and time inputs in Safari ([#81361](https://github.com/WordPress/gutenberg/pull/81361)).
- `ControlWithError`: Re-read the target's validation message when an `invalid` event is received, so a message that changed without a re-render in between (e.g. a programmatic value change followed by a synthetic `invalid` event) is not revealed stale or empty. While a `validating` custom validity is pending, the message is left untouched so the pending indicator keeps showing ([#81440](https://github.com/WordPress/gutenberg/pull/81440)).

### TypeScript

- `ComboboxControl`: Narrow the `onChange` callback parameter type to `string | null`, matching the values the component actually passes. The previous indexed-access type on the optional `value` prop leaked an accidental `undefined` into the union ([#81568](https://github.com/WordPress/gutenberg/pull/81568)).

### Internal

- Remove `ValidatedComboboxControl` from the private APIs; it now lives internally in `@wordpress/dataviews`, its only consumer ([#81449](https://github.com/WordPress/gutenberg/pull/81449)).
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/combobox-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Function called when the control's search input value changes. The argument cont

Function called when the selected value changes.

- Type: `( value: string | null | undefined ) => void`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The undefined type was even documented as something we supported.

- Type: `( value: string | null ) => void`
- Required: No

#### value
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/combobox-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export type ComboboxControlOption = {
[ key: string ]: any;
};

type ComboboxControlValue = string | null;

export type ComboboxControlProps = Pick<
BaseControlProps,
| '__nextHasNoMarginBottom'
Expand Down Expand Up @@ -65,7 +67,7 @@ export type ComboboxControlProps = Pick<
/**
* Function called with the selected value changes.
*/
onChange?: ( value: ComboboxControlProps[ 'value' ] ) => void;
onChange?: ( value: ComboboxControlValue ) => void;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

/**
* Function called when the control's search input value changes. The argument contains the next input value.
*
Expand All @@ -79,7 +81,7 @@ export type ComboboxControlProps = Pick<
/**
* The current value of the control.
*/
value?: string | null;
value?: ComboboxControlValue;
/**
* If passed, the combobox input will show a placeholder string if no values are present.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
### Internal

- Point tsconfig references at split dependencies' build projects. ([#81509](https://github.com/WordPress/gutenberg/pull/81509))
- DataForm: Narrow the combobox control's `onChange` handler parameter back to `string | null`, following the upstream `ComboboxControl` type fix that removed the accidental `undefined` from the callback type. [#81568](https://github.com/WordPress/gutenberg/pull/81568)
- DataForm: Internalize `ValidatedComboboxControl` instead of unlocking it from the `@wordpress/components` private APIs. [#81449](https://github.com/WordPress/gutenberg/pull/81449)
- DataForm: Internalize `ValidatedFormTokenField` instead of unlocking it from the `@wordpress/components` private APIs. [#81451](https://github.com/WordPress/gutenberg/pull/81451)
- DataForm: Internalize `ValidatedToggleControl` instead of unlocking it from the `@wordpress/components` private APIs. [#81492](https://github.com/WordPress/gutenberg/pull/81492)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function Combobox< Item >( {
const value = getValue( { item: data } ) ?? '';

const onChangeControl = useCallback(
( newValue: string | null | undefined ) =>
( newValue: string | null ) =>
onChange( setValue( { item: data, value: newValue ?? '' } ) ),
[ data, onChange, setValue ]
);
Expand Down
1 change: 1 addition & 0 deletions packages/fields/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Internal

- Point tsconfig references at split dependencies' build projects. ([#81509](https://github.com/WordPress/gutenberg/pull/81509))
- `parent`: Narrow the combobox `onChange` handler parameter to `string | null`, following the upstream `ComboboxControl` type fix that removed the accidental `undefined` from the callback type. ([#81568](https://github.com/WordPress/gutenberg/pull/81568))

## 0.45.0 (2026-08-12)

Expand Down
2 changes: 1 addition & 1 deletion packages/fields/src/fields/parent/parent-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export function PageAttributesParent( {
*
* @param {Object} selectedPostId The selected Author.
*/
const handleChange = ( selectedPostId: string | null | undefined ) => {
const handleChange = ( selectedPostId: string | null ) => {
if ( selectedPostId ) {
return onChangeControl( parseInt( selectedPostId, 10 ) ?? 0 );
}
Expand Down
4 changes: 4 additions & 0 deletions packages/media-fields/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Internal

- `attached_to`: Narrow the combobox `onChange` handler parameter to `string | null`, following the upstream `ComboboxControl` type fix that removed the accidental `undefined` from the callback type. ([#81568](https://github.com/WordPress/gutenberg/pull/81568))

## 0.18.0 (2026-08-12)

### Bug Fixes
Expand Down
4 changes: 1 addition & 3 deletions packages/media-fields/src/attached_to/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ export default function MediaAttachedToEdit( {
*
* @param {Object} selectedPostId The selected post id.
*/
const handleSelectOption = (
selectedPostId: string | null | undefined
) => {
const handleSelectOption = ( selectedPostId: string | null ) => {
if ( ! selectedPostId ) {
handleDetach();
return;
Expand Down
Loading