Skip to content

Commit 901a591

Browse files
chesterkmralonp99
andauthored
feat: added safe value check to autcomplete (#2811)
* feat: added safe value check to autcomplete * feat: added safe value check to autcomplete --------- Co-authored-by: Alon Peretz <[email protected]>
1 parent d6cf4ce commit 901a591

File tree

9 files changed

+42
-11
lines changed

9 files changed

+42
-11
lines changed

apps/kyb-app/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# kyb-app
22

3+
## 0.3.73
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.5.41
9+
310
## 0.3.72
411

512
### Patch Changes

apps/kyb-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/kyb-app",
33
"private": true,
4-
"version": "0.3.72",
4+
"version": "0.3.73",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -16,7 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@ballerine/blocks": "0.2.24",
19-
"@ballerine/ui": "0.5.40",
19+
"@ballerine/ui": "0.5.41",
2020
"@ballerine/common": "^0.9.46",
2121
"@ballerine/workflow-browser-sdk": "0.6.58",
2222
"@lukemorales/query-key-factory": "^1.0.3",

packages/react-pdf-toolkit/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @ballerine/react-pdf-toolkit
22

3+
## 1.2.41
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @ballerine/ui@0.5.41
9+
310
## 1.2.40
411

512
### Patch Changes

packages/react-pdf-toolkit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/react-pdf-toolkit",
33
"private": false,
4-
"version": "1.2.40",
4+
"version": "1.2.41",
55
"types": "./dist/build.d.ts",
66
"main": "./dist/react-pdf-toolkit.js",
77
"module": "./dist/react-pdf-toolkit.mjs",
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@ballerine/config": "^1.1.22",
30-
"@ballerine/ui": "0.5.40",
30+
"@ballerine/ui": "0.5.41",
3131
"@react-pdf/renderer": "^3.1.14",
3232
"@sinclair/typebox": "^0.31.7",
3333
"ajv": "^8.12.0",

packages/ui/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @ballerine/ui
22

3+
## 0.5.41
4+
5+
### Patch Changes
6+
7+
- Added safeValue to autocomplete
8+
39
## 0.5.40
410

511
### Patch Changes

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ballerine/ui",
33
"private": false,
4-
"version": "0.5.40",
4+
"version": "0.5.41",
55
"type": "module",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",

packages/ui/src/components/molecules/inputs/AutocompleteInput/AutocompleteInput.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ export const AutocompleteInput = ({
3838
onChange,
3939
onBlur,
4040
}: AutocompleteInputProps) => {
41+
const safeValue = useMemo(() => {
42+
if (typeof value !== 'string') {
43+
console.warn('AutocompleteInput: value is not a string', value);
44+
console.warn('Empty string will be used');
45+
46+
return '';
47+
}
48+
49+
return value;
50+
}, [value]);
51+
4152
const optionLabels = useMemo(() => options.map(option => option.value), [options]);
4253

4354
const handleChange: NonNullable<ComponentProps<typeof Autocomplete>['onChange']> = useCallback(
@@ -66,7 +77,7 @@ export const AutocompleteInput = ({
6677
options={optionLabels}
6778
getOptionLabel={label => label}
6879
freeSolo
69-
inputValue={value}
80+
inputValue={safeValue}
7081
PaperComponent={Paper as ComponentProps<typeof Autocomplete>['PaperComponent']}
7182
onChange={handleChange}
7283
disabled={disabled}

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)