fix: Array data type accepts whitespace as input (#7707)

## Description

- This PR fixes the issue #7593

Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
Harshit Singh 2024-10-16 21:22:32 +05:30 committed by GitHub
parent ba2ee0da72
commit 03dd7527b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useLis
import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldMetadataType } from '~/generated-metadata/graphql';
import { moveArrayItem } from '~/utils/array/moveArrayItem'; import { moveArrayItem } from '~/utils/array/moveArrayItem';
import { toSpliced } from '~/utils/array/toSpliced'; import { toSpliced } from '~/utils/array/toSpliced';
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
const StyledDropdownMenu = styled(DropdownMenu)` const StyledDropdownMenu = styled(DropdownMenu)`
left: -1px; left: -1px;
@ -190,7 +191,11 @@ export const MultiItemFieldInput = <T,>({
}) })
: undefined : undefined
} }
onChange={(event) => handleOnChange(event.target.value)} onChange={(event) =>
handleOnChange(
turnIntoEmptyStringIfWhitespacesOnly(event.target.value),
)
}
onEnter={handleSubmitInput} onEnter={handleSubmitInput}
rightComponent={ rightComponent={
<LightIconButton <LightIconButton