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

tb.dispose() in dev mode not working. #229

Closed
DevArt002 opened this issue Apr 10, 2021 · 5 comments
Closed

tb.dispose() in dev mode not working. #229

DevArt002 opened this issue Apr 10, 2021 · 5 comments
Assignees
Labels
🪲 bug Something isn't working
Milestone

Comments

@DevArt002
Copy link

According to your advice, I open issue again.

I am using threebox-plugin for 3d visualization on mapbox. It is integrated with React SPA.
Whenever page is refreshed/reloaded or navigated to another page, tb should be disposed.
When I refresh the page with F5 or CMD+R manually, tb.dispose() works. But whenever the page is refreshed during React development, it doesn't work.

Below I described code snippets:

Class that contains threebox-plugin implementation:

class ThreeboxController {
  ...
  dispose(): void {
    window.tb.dispose();
    window.tb = {};
  }
  ...
}

In react component:

useEffect(() => {
  return () => {
    threeboxController.dispose();
  };
}, []);

(It means that threebox should be disposed whenever page is unmounted)

In dev mode, whenever I change some code and save it, the React page is refreshed automatically. But it shows error:

Screenshots:
preview

dispose error

@DevArt002 DevArt002 added the 🪲 bug Something isn't working label Apr 10, 2021
@jscastro76
Copy link
Owner

I will investigate this one... it seems scene.dispose has been removed from THREE

@jscastro76 jscastro76 self-assigned this Apr 10, 2021
@DevArt002
Copy link
Author

Thank you @jscastro76

@jscastro76
Copy link
Owner

Found... Apparently scene.dispose() was removed in three.js r122, but the migration guide.

Easy to solve... resolving it directly to include it in the next release v2.2.2. that I want to upload tomorrow.

@jscastro76 jscastro76 added this to the v2.2.2. milestone Apr 10, 2021
@DevArt002
Copy link
Author

Awesome! I am excited with v2.2.2.

jscastro76 added a commit that referenced this issue Apr 11, 2021
Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements and bugs.

**WARNING**: This version updates to Mapbox **2.2.0**. Despite v1.11.1 still supported, if used, some features from mapbox v.2.0.1 won't be obviously available such as sky layers.
**Known issue**: `BuildingShadow` wont work as the definition of the layers has changed.

#### ✨ Enhancements

Add a better light for night on 14-buildingshadow.html example #118
- #146 Update to Mapbox 2.2
  - #225 Mapbox 2.2: Update Depth calculation keeping compatibility with previous versions
  - #226 Mapbox 2.2: Update all the examples (14-buildingshadow & 17-azuremaps not updated)
  - #232 Mapbox 2.2: Add sky layer as an option in threebox
  - Updated example [07-alignmentTest.html](https://github.com/jscastro76/threebox/blob/master/examples/07-alignmentTest.html)
  - Updated example [12-add3dmodel.html](https://github.com/jscastro76/threebox/blob/master/examples/12-add3dmodel.html)
  - Updated example [13-eiffel.html](https://github.com/jscastro76/threebox/blob/master/examples/13-eiffel.html)
- #224 Ignore worker_threads
- #229 tb.dispose() in dev mode not working. It was removed from three.js but not included in migration guide.
- #234 Update all the examples to include antialias: true in the webglcontext

#### 🪲 Bug fixes
- #223 Can't resolve worker threads
- #230 Module not found: Can't resolve 'worker_threads' (duplicated #223)

#### 📝 Documentation
- Updated [documentation](/examples/readme.md) (Added a note on the examples updated to Mapbox 2.2.0)
- Updated [Threebox documentation](/docs/Threebox.md) (public cdns data, `sky` attribute and property, `tb.createSkyLayer`, `tb.getSunSky`, `tb.updateSunSky`, `tb.updateLightHelper`, )
- Updated [Examples](/examples) documentation (new sky layers in 7, 12, 13).
@jscastro76
Copy link
Owner

Please @DevArt002 check if the new module v2.2.2 has solved your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants