Conditionally render ScoreCube to properly clean up WebGL canvas

Only mount the ScoreCube component when on the save-editor page.
This ensures onDestroy is called when navigating away, properly
disposing of the WebGL renderer and removing the canvas from DOM.
This commit is contained in:
Christian Semmler 2026-01-31 13:26:37 -08:00
parent 3b02784c81
commit f45831a4b4
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C

View File

@ -1,4 +1,5 @@
<script> <script>
import { currentPage } from '../../stores.js';
import ScoreCube from './ScoreCube.svelte'; import ScoreCube from './ScoreCube.svelte';
export let slot; export let slot;
@ -13,10 +14,12 @@
</script> </script>
<div class="scores-editor"> <div class="scores-editor">
<ScoreCube {#if $currentPage === 'save-editor'}
missions={missionData} <ScoreCube
onUpdate={handleCubeUpdate} missions={missionData}
/> onUpdate={handleCubeUpdate}
/>
{/if}
</div> </div>
<style> <style>