Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene breaks when cast-shadow enabled and navigating back to a previously initialized scene #507

Closed
5 tasks done
lnvglr opened this issue Oct 11, 2024 · 1 comment
Closed
5 tasks done

Comments

@lnvglr
Copy link

lnvglr commented Oct 11, 2024

Describe the bug

I have a Nuxt 3 app and in it a page with a Tres.js scene. The scene contains <TresDirectionalLight cast-shadow /> which casts a shadow. When navigating away from the page with the scene and navigating back to the scene (using NuxtLink), I get the error below.

When I remove the cast-shadow prop, the bug disappears.

three.js?v=f17f74c8:17801 Uncaught TypeError: Cannot read properties of null (reading 'state')
    at setProgram (three.js?v=f17f74c8:17801:41)
    at WebGLRenderer.renderBufferDirect (three.js?v=f17f74c8:17292:23)
    at renderObject (three.js?v=f17f74c8:13624:21)
    at renderObject (three.js?v=f17f74c8:13631:7)
    at WebGLShadowMap.render (three.js?v=f17f74c8:13519:9)
    at WebGLRenderer.render (three.js?v=f17f74c8:17493:17)
    at tres.js:387:33
    at index.mjs:71:52
    at Array.map (<anonymous>)
    at Object.trigger (index.mjs:71:40)
complete error log
setProgram				@	three.js?v=f17f74c8:17801
WebGLRenderer.renderBufferDirect	@	three.js?v=f17f74c8:17292
renderObject				@	three.js?v=f17f74c8:13624
renderObject				@	three.js?v=f17f74c8:13631
WebGLShadowMap.render			@	three.js?v=f17f74c8:13519
WebGLRenderer.render			@	three.js?v=f17f74c8:17493
(anonymous)				@	tres.js:387
(anonymous)				@	index.mjs:71
trigger					@	index.mjs:71
we.immediate				@	tres.js:160
loop					@	index.mjs:617
requestAnimationFrame		
resume					@	index.mjs:624
or					@	tres.js:388
cr					@	tres.js:593
(anonymous)				@	tres.js:1086
(anonymous)				@	runtime-core.esm-bundler.js:2757
callWithErrorHandling			@	runtime-core.esm-bundler.js:199
callWithAsyncErrorHandling		@	runtime-core.esm-bundler.js:206
hook.__weh.hook.__weh			@	runtime-core.esm-bundler.js:2737
flushPostFlushCbs			@	runtime-core.esm-bundler.js:385
flushJobs				@	runtime-core.esm-bundler.js:427
Promise.then		
queueFlush				@	runtime-core.esm-bundler.js:322
queuePostFlushCb			@	runtime-core.esm-bundler.js:336
queueEffectWithSuspense			@	runtime-core.esm-bundler.js:7256
baseWatchOptions.scheduler		@	runtime-core.esm-bundler.js:6138
effect2.scheduler			@	reactivity.esm-bundler.js:1892
trigger					@	reactivity.esm-bundler.js:250
endBatch				@	reactivity.esm-bundler.js:308
notify					@	reactivity.esm-bundler.js:594
trigger					@	reactivity.esm-bundler.js:568
set value				@	reactivity.esm-bundler.js:1510
finalizeNavigation			@	vue-router.mjs:3478
(anonymous)				@	vue-router.mjs:3343
Promise.then		
pushWithRedirect			@	vue-router.mjs:3310
push					@	vue-router.mjs:3235
navigate				@	vue-router.mjs:2300
callWithErrorHandling			@	runtime-core.esm-bundler.js:199
callWithAsyncErrorHandling		@	runtime-core.esm-bundler.js:206
invoker					@	runtime-dom.esm-bundler.js:722

Reproduction

https://stackblitz.com/edit/nuxt-starter-w3neca?file=pages%2Findex.vue

Steps to reproduce

No response

System Info

System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 79.77 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 9.4.0 - ~/Library/pnpm/pnpm
    bun: 1.0.3 - ~/.bun/bin/bun
  Browsers:
    Chrome: 129.0.6668.100
    Safari: 17.6
  npmPackages:
    @tresjs/cientos: ^4.0.3 => 4.0.2 
    @tresjs/core: ^4.2.10 => 4.2.10 
    @tresjs/nuxt: ^3.0.7 => 3.0.7

Used Package Manager

npm

Code of Conduct

@lnvglr
Copy link
Author

lnvglr commented Oct 11, 2024

Moved the issue to the core: Tresjs/tres#851

@lnvglr lnvglr closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant