Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(print_preview): increase deboucing
Elian Doran979d408a44b0
diff --git a/apps/client/src/widgets/dialogs/print_preview.tsx b/apps/client/src/widgets/dialogs/print_preview.tsxindex 88a463be99..73c4826c89 100644--- a/apps/client/src/widgets/dialogs/print_preview.tsx+++ b/apps/client/src/widgets/dialogs/print_preview.tsx@@ -195,16 +195,23 @@ export default function PrintPreviewDialog() {});}, []);+ const isFirstGenerationRef = useRef(true);+useEffect(() => {if (!shown || !pageRangesValid) return;++ const delay = isFirstGenerationRef.current ? 0 : 800;+ isFirstGenerationRef.current = false;+const handle = setTimeout(() => {regeneratePreview({ landscape, pageSize, scale, margins: marginsStr, pageRanges: pageRanges.trim() });- }, 400);+ }, delay);return () => clearTimeout(handle);}, [shown, landscape, pageSize, scale, marginsStr, pageRanges, pageRangesValid, regeneratePreview]);function handleClose() {setShown(false);+ isFirstGenerationRef.current = true;toast.closePersistent("print-preview-error");if (pdfUrlRef.current) {URL.revokeObjectURL(pdfUrlRef.current);