fix: lint issue
This commit is contained in:
1 file changed
+3
-14
@@ -27,24 +27,13 @@ export const WidgetMultiTextInput = ({ property, kind, options }: CommonWidgetIn
|
|||||||
};
|
};
|
||||||
|
|
||||||
const currentValidationResult = React.useMemo(() => {
|
const currentValidationResult = React.useMemo(() => {
|
||||||
if (!options.validate) {
|
return options.validate.safeParse(search);
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
result: null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const validationResult = options.validate.safeParse(search);
|
|
||||||
return {
|
|
||||||
success: validationResult.success,
|
|
||||||
result: validationResult,
|
|
||||||
};
|
|
||||||
}, [options.validate, search]);
|
}, [options.validate, search]);
|
||||||
|
|
||||||
const error = React.useMemo(() => {
|
const error = React.useMemo(() => {
|
||||||
/* hide the error when nothing is being typed since "" is not valid but is not an explicit error */
|
/* hide the error when nothing is being typed since "" is not valid but is not an explicit error */
|
||||||
if (!currentValidationResult.success && currentValidationResult.result && search.length !== 0) {
|
if (!currentValidationResult.success && search.length !== 0) {
|
||||||
return currentValidationResult.result.error?.issues[0]?.message;
|
return currentValidationResult.error.issues[0]?.message;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}, [currentValidationResult, search]);
|
}, [currentValidationResult, search]);
|
||||||
|
|||||||
Reference in new issue
Block a user