Skip to content

Commit

Permalink
fix: stop generating images in advance
Browse files Browse the repository at this point in the history
  • Loading branch information
byodian committed Dec 23, 2024
1 parent 9a56987 commit 48398ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/components/header/export-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 0 additions & 5 deletions src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ export function Header(props: HeaderProps) {
const { toast } = useToast()
const fileRef = useRef<HTMLInputElement>(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)) {
Expand Down

0 comments on commit 48398ca

Please sign in to comment.