mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
fix: prevent WebGLRenderer leak in app mode 3D preview (#9766)
## Summary Reuse the Load3d instance when switching between 3D results in app mode instead of creating a new WebGLRenderer each time. Add onUnmounted cleanup to Preview3d to release WebGL resources when the component is removed. ## Screenshots (if applicable) before https://github.com/user-attachments/assets/c9818d10-941f-4994-9b48-2710c88454e7 after https://github.com/user-attachments/assets/36361763-6800-4bc8-8089-14d64b7fcd16 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9766-fix-prevent-WebGLRenderer-leak-in-app-mode-3D-preview-3216d73d365081e19305d7255b71bc49) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, useTemplateRef, watch } from 'vue'
|
||||
import { onUnmounted, ref, useTemplateRef, watch } from 'vue'
|
||||
|
||||
import Load3DControls from '@/components/load3d/Load3DControls.vue'
|
||||
import AnimationControls from '@/components/load3d/controls/AnimationControls.vue'
|
||||
@@ -19,6 +19,10 @@ watch([containerRef, () => modelUrl], async () => {
|
||||
await viewer.value.initializeStandaloneViewer(containerRef.value, modelUrl)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
viewer.value.cleanup()
|
||||
})
|
||||
|
||||
//TODO: refactor to add control buttons
|
||||
</script>
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user