diff --git a/src/components/header/export-dialog.tsx b/src/components/header/export-dialog.tsx index 2857c29..5f66fbd 100644 --- a/src/components/header/export-dialog.tsx +++ b/src/components/header/export-dialog.tsx @@ -117,9 +117,11 @@ export function ExportImageDialog({ } if (previewRef.current && previewRef.current.itemRefs.current && previewRef.current.containerRef.current) { - generateImages() + if (isExportModalOpen) { + generateImages() + } } - }, [previewRef, scale, setIsExporting, isExporting]) + }, [previewRef, scale, setIsExporting, isExporting, isExportModalOpen]) const exportImages = useCallback(async () => { const zip = new JSZip() diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 091c0dc..bc213d5 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -80,11 +80,6 @@ export function Header(props: HeaderProps) { const { toast } = useToast() const fileRef = useRef(null) - useEffect(() => { - // Regenerate images when the contents are updated - setIsExporting(true) - }, [contents]) - useEffect(() => { function handleKeyDown(e: KeyboardEvent) { if (e.key === 'o' && (e.metaKey || e.ctrlKey)) {