Skip to content

Commit

Permalink
Merge pull request #2871 from Nicetouchco/fix/dispose
Browse files Browse the repository at this point in the history
[v9] fix: dispose properly binds its object
  • Loading branch information
krispya authored Jun 10, 2023
2 parents 35333c9 + 9e0b2d1 commit cab6d59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/fiber/src/core/reconciler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ function removeChild(
// - cannot be a <primitive object={...} />
// - cannot be a THREE.Scene, because three has broken its own API
if (shouldDispose && child.type !== 'primitive' && child.object.type !== 'Scene') {
const dispose = child.object.dispose
if (typeof dispose === 'function') {
if (typeof child.object.dispose === 'function') {
const dispose = child.object.dispose.bind(child.object)
scheduleCallback(idlePriority, () => {
try {
dispose()
Expand Down

0 comments on commit cab6d59

Please sign in to comment.