mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-04 05:01:37 +02:00
The browser-side 3MF parser in ModelViewer.tsx runs entirely on the main thread (JSZip extract + DOMParser + vertex/triangle iteration), and Bambu's external-component shape chains one of these per part. Multi-color parted statues from MakerWorld can spend tens of seconds in straight-line JS, during which the modal close button can't fire and the browser shows "page unresponsive". Add nextTick() yields at four hot spots: - every 20 000 vertex iterations inside parseMeshFromDoc - every 20 000 triangle iterations inside parseMeshFromDoc - the matching loops in parse3MF's direct-mesh path - once per top-level <object> iteration in parse3MF - once per <component> iteration in parse3MF This doesn't make parsing faster — it surrenders control to the browser between batches so the modal stays interactive. Proper Web Worker refactor is a tracked follow-up.