|
|
@@ -35,16 +35,19 @@ const PageBulkExportSelectModalSubstance = (): JSX.Element => {
|
|
|
setFormatMemoForRestart(format);
|
|
|
await apiv3Post('/page-bulk-export', { path: currentPagePath, format });
|
|
|
toastSuccess(t('page_export.bulk_export_started'));
|
|
|
+ close();
|
|
|
} catch (e) {
|
|
|
const errorCode = e?.[0].code ?? 'page_export.failed_to_export';
|
|
|
if (errorCode === 'page_export.duplicate_bulk_export_job_error') {
|
|
|
+ // Keep the substance mounted so the restart modal can render.
|
|
|
+ // Closing here would unmount the substance and discard isRestartModalOpened.
|
|
|
setDuplicateJobInfo(e[0].args.duplicateJob);
|
|
|
setIsRestartModalOpened(true);
|
|
|
} else {
|
|
|
toastError(t(errorCode));
|
|
|
+ close();
|
|
|
}
|
|
|
}
|
|
|
- close();
|
|
|
},
|
|
|
[close, currentPagePath, t],
|
|
|
);
|
|
|
@@ -62,12 +65,14 @@ const PageBulkExportSelectModalSubstance = (): JSX.Element => {
|
|
|
toastError(t('page_export.failed_to_export'));
|
|
|
}
|
|
|
setIsRestartModalOpened(false);
|
|
|
+ close();
|
|
|
}
|
|
|
- }, [currentPagePath, formatMemoForRestart, t]);
|
|
|
+ }, [close, currentPagePath, formatMemoForRestart, t]);
|
|
|
|
|
|
const handleCloseRestartModal = useCallback(() => {
|
|
|
setIsRestartModalOpened(false);
|
|
|
- }, []);
|
|
|
+ close();
|
|
|
+ }, [close]);
|
|
|
|
|
|
// Memoize format display text to prevent recalculation
|
|
|
const formatDisplayText = useMemo(() => {
|