mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
## Summary Fix 3D asset disappearing when switching between 3D and image outputs in app mode — missing `onUnmounted` cleanup leaked WebGL contexts. ## Changes - **What**: Add `onUnmounted` hook to `Preview3d.vue` that calls `viewer.cleanup()`, releasing the WebGL context when Vue destroys the component via its v-if chain. Add unit tests covering init, cleanup on unmount, and remount behavior. ## Review Focus When switching outputs in app mode, Vue's v-if chain destroys and recreates `Preview3d`. Without `onUnmounted` cleanup, the old `Load3d` instance (WebGL context, RAF loop, ResizeObserver) leaks. After ~8-16 toggles, the browser's WebGL context limit is exhausted and new 3D viewers silently fail to render. <!-- Pipeline-Ticket: e36489d2-a9fb-47ca-9e27-88eb3170836b --> --------- Co-authored-by: Alexander Brown <drjkl@comfy.org>