Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(export): drop an export the dialog closed while the click sound was read

EtienneLescotb6c20fe29263
diff --git a/src/components/ai-edition/ExportDialog.tsx b/src/components/ai-edition/ExportDialog.tsx
index 645fb4641..a336901d8 100644
--- a/src/components/ai-edition/ExportDialog.tsx
+++ b/src/components/ai-edition/ExportDialog.tsx
@@ -378,6 +378,8 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {
// reads synchronously, so the read happens here — before anything is composed. Clicks
// that will not load must not cost the user their export.
await prepareClickSound(document).catch(() => undefined);
+ // A close during that read has already run the cleanup, which had no job to cancel yet.
+ if (generation !== pickerGeneration.current) return;
{
const job: ActiveExport = { id: crypto.randomUUID(), cancelRequested: false };
activeExport.current = job;