Tresjs / tres

Declarative ThreeJS using Vue Components
https://tresjs.org
MIT License
1.91k stars 85 forks source link

Cannot read properties of undefined (reading 'dispose') - GridHelper #721

Open whitespacecode opened 4 weeks ago

whitespacecode commented 4 weeks ago

Describe the bug

When i try to show/hide the GridHelper i get a TypeError. The code still works. I tried it on an older tresjs version and no typeError happend.

<TresGridHelper v-if="gridHelper.visible" :args="[10, 100, 0xff0000]" /> image

Not sure if that is also the case for other components.

Reproduction

https://stackblitz.com/edit/tresjs-basic-hfgtuj

Steps to reproduce

Use the reproduction, click on the button 'Toggle Grid' and check the console logs.

System Info

System:
    OS: macOS 14.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 90.73 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v18.18.0/bin/yarn
    npm: 10.6.0 - ~/Code/Modulab/node_modules/.bin/npm
  Browsers:
    Chrome: 125.0.6422.142
  npmPackages:
    @tresjs/cientos: ^3.9 => 3.9.0
    @tresjs/core: ^4.0.2 => 4.0.2
    vite: ^5.2.10 => 5.2.10

Used Package Manager

npm

Code of Conduct

garrlker commented 3 weeks ago

Looks like we're calling .dispose() twice when this is removed from the scene. Easy fix, though it's interesting how this bug got in

alvarosabu commented 7 hours ago

@andretchen0 is this solved by the disposal refactor?

andretchen0 commented 4 hours ago

@alvarosabu

is this solved by the disposal refactor?

Most likely. I will make a test from the reproduction and add it to the nodeOps tests.