diff --git a/packages/dataviews/src/field-types/integer.tsx b/packages/dataviews/src/field-types/integer.tsx index 1233c3ab555567..bd4956493232df 100644 --- a/packages/dataviews/src/field-types/integer.tsx +++ b/packages/dataviews/src/field-types/integer.tsx @@ -53,7 +53,7 @@ function Edit< Item >( { ( newValue: string | undefined ) => onChange( ( prevItem: Item ) => ( { ...prevItem, - [ id ]: newValue, + [ id ]: Number( newValue ), } ) ), [ id, onChange ] ); diff --git a/packages/dataviews/src/normalize-fields.ts b/packages/dataviews/src/normalize-fields.ts index 680749df5344a6..4468c228322e2d 100644 --- a/packages/dataviews/src/normalize-fields.ts +++ b/packages/dataviews/src/normalize-fields.ts @@ -42,13 +42,10 @@ export function normalizeFields< Item >( const renderFromElements = ( { item }: { item: Item } ) => { const value = getValue( { item } ); - const label = field?.elements?.find( ( element ) => { - // Intentionally using == here to allow for type coercion. - // eslint-disable-next-line eqeqeq - return element.value == value; - } )?.label; - - return label || value; + return ( + field?.elements?.find( ( element ) => element.value === value ) + ?.label || getValue( { item } ) + ); }; const render =