Skip to content

When TresCanvas is unmounted, an error occurs equal to the number of Html components. #587

@angrymusic

Description

@angrymusic

Describe the bug

When TresCanvas is unmounted, an error occurs equal to the number of Html components.
hook.js:608 THREE.Material: parameter 'vertexShader' has value of undefined.

<template>
  <div class="about">
    <h1>This is an about page</h1>
    <div class="canvas">
      <TresCanvas v-bind="gl">
        <OrbitControls />
        <TresPerspectiveCamera :position="[5, 5, 5]" />
        <!-- Your scene here -->
        <TresMesh cast-shadow :position="[0, 0, 0]">
          <TresBoxGeometry :args="[1, 1, 2]" />
          <TresMeshToonMaterial color="blue" />
          <Html center transform sprite>
            <div class="text">TEXT</div>
          </Html>
        </TresMesh>
      </TresCanvas>
    </div>
  </div>
</template>
<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { Html, OrbitControls } from '@tresjs/cientos'
const gl = {
  clearColor: '#87CEEB',
  shadows: true,
  alpha: true,
  shadowMapType: BasicShadowMap,
  outputColorSpace: SRGBColorSpace,
  toneMapping: NoToneMapping,
}
</script>
<style>
.canvas {
  width: 500px;
  height: 500px;
  position: relative;
}
.text {
  color: white;
  font-weight: bold;
  font-size: 30px;
}
</style>


hook.js:608 THREE.Material: parameter 'vertexShader' has value of undefined.

now about page
스크린샷 2025-01-14 161928

if I go home?
스크린샷 2025-01-14 161935
If I add Html components, the error increases by the corresponding number.

Reproduction

https://stackblitz.com/edit/tresjs-basic-4pso7hpr?file=src%2Fcomponents%2FTheExperience.vue

Steps to reproduce

No response

System Info

npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers
Need to install the following packages:
[email protected]
Ok to proceed? (y) y


  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (8) x64 13th Gen Intel(R) Core(TM) i7-1355U
    Memory: 1.70 GB / 7.76 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    npm: 11.0.0 - ~/.nvm/versions/node/v20.18.0/bin/npm
  npmPackages:
    @tresjs/cientos: ^4.0.3 => 4.0.3 
    @tresjs/core: ^4.3.2 => 4.3.2 
    vite: ~6.0.6 => 6.0.6

Used Package Manager

npm

Code of Conduct

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions