KamoCRM

Defer setTotalPages until after PDF dim loop to prevent PDF.js worker saturation

Fixkamo-internal
Shipped
12 ஏப்ரல், 2026 அன்று 3:50 PM UTC
Author
kamo
Commit
cb85347

On a 50-page PDF, calling setTotalPages before the getPage() dimension loop mounts all 50 ThumbnailCanvas components immediately. Each falls back to PDF.js (server thumbnails aren't generated for templates), queuing 50 concurrent tasks in the shared PDF.js web worker — overwhelming it and causing the dim loop's getPage() calls to stall indefinitely, keeping loading=true and showing "Loading PDF..." forever. Fix: move setTotalPages/onPdfLoaded to after the dim loop completes so thumbnails only render once the main PDF canvas is fully ready. Also fix designStore.loadDesign not resetting isLoading when a 200 OK response returns with no designData (null/undefined), which would leave the page stuck on "Loading template..." for fresh templates.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing