How to switch between canvases?

I’m using SvelteKit and i have 2 .svelte files with seperate canvases, whenever i route between the 2, the canvas and three.js script from the first file is kept, and the other one only shows whenever i ctrl+r the page.
Any way around this ?

Can you share a minimal reproducible example of this issue? It should be easy to switch between two canvases / from different components (either by having them re-use one shared canvas and each will clear it and re-draw into it when the component is shown) or having each maintain/create/destroy its own canvas

I’m not as familiar with Svelte so don’t know what the issue might be off the top of my head without being able to take a look at what you have so far

Make a routes folder in a skeleton project from npm create vite@latest, then put 2 folders in routes, each with a +page.svelte with elements and a three.js script in each, then an anchor element that redirects one to another, you will see that the second canvas is not shown.