From 7c473d3545e58498b999b3206c21c2f0f4abb55c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 6 Mar 2024 16:56:31 +0100 Subject: [PATCH] Add Teardown code --- src/components/3d/PublicPreview.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/3d/PublicPreview.svelte b/src/components/3d/PublicPreview.svelte index 87bfa44..46ae07a 100644 --- a/src/components/3d/PublicPreview.svelte +++ b/src/components/3d/PublicPreview.svelte @@ -88,11 +88,13 @@ }); onDestroy(() => { - loaded = false; + if (loaded) { + loaded = false; - renderer.dispose(); - scene.clear(); - light.dispose(); + renderer.dispose(); + scene.clear(); + light.dispose(); + } }) function handleResize() {