Nuxt3 and Three.js bug
Hello, I have a little problem or I can't find the answer anywhere on the internet (stackoverflow, youtube, etc). I try to make a planet appear in three.js but when I change page with NuxtLink and then I come back to my page where there is my planet, it disappears and does not show any error, I noticed that if I readjust my window in size it reappears. Anyone have an idea where this is coming from? I give you the code below.
9 Replies
I guess you need to make the function inside onMounted
async
and add await nextTick()
in the beginning of it, since elements are available only after nextTick
in script setup
😅I try this :
And my planet still does not appear :/
So I tried your original code and it works, weird
nuxt version is 3.4.1 and three version is 0.151.3
So when you use NuxtLink and you leave the page and come back to the original one you don't have any problems to see the planet?
No (i have different model, but its loading fine)
Are you coming back to the page via back button or another NuxtLink?
By NuxtLink
But if I touch the size of my window or open the inspector the planet element appears
Hmm, still works, the model takes some time to load, but its working
I don't understand where it comes from knowing that for example when I trigger a 404 and I come back to my model page it loads well
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View