From 1a7b790d7e53b8aae289e27f3b30c8eaf027892b Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Fri, 20 Dec 2024 15:47:19 +0000 Subject: [PATCH] Apply suggestions from code review Co-authored-by: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com> --- src/components/product/ProductImages.tsx | 2 +- src/pages/chat/components/UploadForm/const.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/product/ProductImages.tsx b/src/components/product/ProductImages.tsx index 6dad5ac9c..bf33132b0 100644 --- a/src/components/product/ProductImages.tsx +++ b/src/components/product/ProductImages.tsx @@ -78,7 +78,7 @@ const getProductImageError = ( typeof Object.values(errors.productImages)?.[0] === "string" ? Object.values(errors.productImages)?.[0] : null; - return String(error); + return error? String(error) : error; }; export default function ProductImages({ onChangeOneSetOfImages }: Props) { const { nextIsDisabled, values, errors } = useForm(); diff --git a/src/pages/chat/components/UploadForm/const.ts b/src/pages/chat/components/UploadForm/const.ts index 13a463747..35b24c177 100644 --- a/src/pages/chat/components/UploadForm/const.ts +++ b/src/pages/chat/components/UploadForm/const.ts @@ -22,7 +22,7 @@ export const validationOfFile = ({ }) => { const formats = supportedFormats || SUPPORTED_FILE_FORMATS; let schema = Yup.mixed(); - if (!isOptional) { + if (isOptional) { schema = schema.nullable(); } return schema