From 80eeffcb4d427b7a813fa9728141f05e01525a53 Mon Sep 17 00:00:00 2001 From: John Tore Simonsen Date: Fri, 4 Oct 2024 14:05:30 +0200 Subject: [PATCH 1/2] Only follow default validation flow of valid size of export, when ExportDefaultSizeLimit - is default value (true) --- src/components/views/dialogs/ExportDialog.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/views/dialogs/ExportDialog.tsx b/src/components/views/dialogs/ExportDialog.tsx index 39e4629f66f..78cdfa5ba88 100644 --- a/src/components/views/dialogs/ExportDialog.tsx +++ b/src/components/views/dialogs/ExportDialog.tsx @@ -83,7 +83,7 @@ const useExportFormState = (): ExportConfig => { : config.includeAttachments ?? false, ); const [numberOfMessages, setNumberOfMessages] = useState(config.numberOfMessages ?? 100); - const [sizeLimit, setSizeLimit] = useState( + const [sizeLimit, setSizeLimit] = useState( SettingsStore.getValue(UIFeature.ExportDefaultSizeLimit) == false ? 20 : config.sizeMb ?? 8, ); @@ -158,11 +158,10 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { const onExportClick = async (): Promise => { const isValidSize = - !setSizeLimit || + (!setSizeLimit || (await sizeLimitRef.current?.validate({ focused: false, - })); - + }))) || !SettingsStore.getValue(UIFeature.ExportDefaultSizeLimit); if (!isValidSize) { sizeLimitRef.current?.validate({ focused: true }); return; From cc8043aa3155a921924d91b7ffb226c567a77d2e Mon Sep 17 00:00:00 2001 From: John Tore Simonsen Date: Fri, 4 Oct 2024 14:31:06 +0200 Subject: [PATCH 2/2] eslint --- src/components/views/dialogs/ExportDialog.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/ExportDialog.tsx b/src/components/views/dialogs/ExportDialog.tsx index 78cdfa5ba88..6adf7fc60f5 100644 --- a/src/components/views/dialogs/ExportDialog.tsx +++ b/src/components/views/dialogs/ExportDialog.tsx @@ -158,10 +158,11 @@ const ExportDialog: React.FC = ({ room, onFinished }) => { const onExportClick = async (): Promise => { const isValidSize = - (!setSizeLimit || + !setSizeLimit || (await sizeLimitRef.current?.validate({ focused: false, - }))) || !SettingsStore.getValue(UIFeature.ExportDefaultSizeLimit); + })) || + !SettingsStore.getValue(UIFeature.ExportDefaultSizeLimit); if (!isValidSize) { sizeLimitRef.current?.validate({ focused: true }); return;