Tresjs / cientos

Collection of useful helpers and fully functional, ready-made abstractions for TresJS
https://cientos.tresjs.org/
MIT License
278 stars 40 forks source link

`<StatsGl />` broken in `3.7.0` #336

Closed kekkorider closed 8 months ago

kekkorider commented 8 months ago

Describe the bug

While upgrading all the packages in my starter I noticed that <StatsGl /> doesn't work and triggers the following error:

Screenshot 2024-01-23 alle 14 00 02

Reproduction

https://stackblitz.com/github/kekkorider/vue-tres-starter/tree/feat/cientos-3.7.0

Steps to reproduce

If you remove the <StatsGl /> component In src/App.vue the error is gone.

System Info

System:
    OS: macOS 14.2.1
    CPU: (8) arm64 Apple M1
    Memory: 485.48 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    pnpm: 8.10.5 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 120.0.6099.234
    Safari: 17.2.1
  npmPackages:
    @tresjs/cientos: ^3.7.0 => 3.7.0 
    @tresjs/core: ^3.6.1 => 3.6.1 
    vite: ^5.0.12 => 5.0.12

Used Package Manager

pnpm

Code of Conduct

JaimeTorrealba commented 8 months ago

Hi, @RenaudRohlinger quick question about this one, debugging a little seems like the problem is that StatsGl his version still uses StatsGl.Container

image That is a photo in my local with all dependencies updated.

In the Cientos Playground works fine with StatsGl.dom. The fix is easy, just check if StatsGl.dom is empty, to use StatsGl.Container. But I'm curious about why this happened. Do you have any Idea?

RenaudRohlinger commented 8 months ago

It's super odd, I just checked the source published on npm and everything points to .dom and there is a fallback available:

  get container() {
    console.warn("Stats: Deprecated! this.container as been replaced to this.dom ");
    return this.dom;
  }

For example if using the source code from the pnpm-lock file in the example: https://registry.npmjs.org/stats-gl/-/stats-gl-2.0.1.tgz

To be honest I have no idea for the solution except the patch proposed on cientos side.

JaimeTorrealba commented 8 months ago

@RenaudRohlinger thanks for answer so fast, and no problem the solution is not difficult.

I just wanted to know why could happen, :) have a nice day