From a30f68103888d097fab4870631073fc7c987b834 Mon Sep 17 00:00:00 2001 From: Carla Paiva Date: Sat, 3 Feb 2024 17:37:03 -0300 Subject: [PATCH] fix: pr comments --- .../converter-steps/upload-step/upload-step.tsx | 11 +++++++++-- src/model/format.ts | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/converter/converter-steps/upload-step/upload-step.tsx b/src/components/converter/converter-steps/upload-step/upload-step.tsx index c4c9b49..e9eb3b3 100644 --- a/src/components/converter/converter-steps/upload-step/upload-step.tsx +++ b/src/components/converter/converter-steps/upload-step/upload-step.tsx @@ -73,8 +73,15 @@ const UploadStep = memo(function UploadStepComponent( const onSelectedFormatChange = useCallback( (value: (string | number)[]) => { - setFormat(value[1] as string) - props.updateSelectedExtension(value[1] as string) + const result = value[1] as string + + if (!result) { + console.warn('Could not read selected format.') + return + } + + setFormat(result) + props.updateSelectedExtension(result) }, [props], ) diff --git a/src/model/format.ts b/src/model/format.ts index 9b8c08a..276f95e 100644 --- a/src/model/format.ts +++ b/src/model/format.ts @@ -1,6 +1,7 @@ -/** Defines a format */ +/** Category of a Format */ type FormatCategory = 'Image' | 'Audio' | 'Video' | 'File' +/** Defines a format */ export type Format = { /** Name o the format */ name: string