KamoCRM

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

Fixkamo-internal
Ya
12 Aprili 2026, 15:50 UTC
Mwandishi
kamo
Ahadi ya
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.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila kitu kinaingia kwenye tovuti yako mwenyewe. Anza kwenye mpango wa bure na usome ukurasa huu tena katika mwezi mmoja.

Kuwa Huru MileleMtazamo wa bei