Skip to content

Commit

Permalink
fix: destroy old planets when new ones are created
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjinp committed Dec 23, 2023
1 parent bfb1da5 commit 6cc5227
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-owls-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hello-worlds/react": patch
---

Dispose old planets when new planets are created
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://user-images.githubusercontent.com/5485824/196038523-2ff806cd-6d75-4d7e-8

## Overview

**CPU-based terrain generation for three.js or react three fiber**
**Multi-threaded, CPU-based terrain generation for three.js or react three fiber**

> **Warning**
> These libraries are a work in progress. APIs may change unexpectedly until they reach version 1.0.
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/planet/Planet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ function PlanetInner<D>(

React.useEffect(() => {
return () => {
helloPlanet.dispose()
helloPlanet?.dispose()
}
}, [])
}, [helloPlanet])

React.useEffect(() => {
if (helloPlanet) {
Expand Down

0 comments on commit 6cc5227

Please sign in to comment.