mirror of
https://github.com/zhigang1992/react-three-fiber.git
synced 2026-04-29 04:45:22 +08:00
fix dispose
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "react-three-fiber",
|
||||
"private": true,
|
||||
"version": "5.0.0-alpha.1",
|
||||
"version": "5.0.0-alpha.2",
|
||||
"description": "A React renderer for Three.js (web and react-native)",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as THREE from 'three'
|
||||
import React from 'react'
|
||||
import Reconciler from 'react-reconciler'
|
||||
// @ts-ignore
|
||||
import Reconciler from 'react-reconciler/cjs/react-reconciler.production.min'
|
||||
import { unstable_now as now, unstable_IdlePriority as idlePriority, unstable_runWithPriority as run } from 'scheduler'
|
||||
import { CanvasContext } from './canvas'
|
||||
|
||||
@@ -311,6 +312,7 @@ function createInstance(
|
||||
props = { dispose: null, ...props }
|
||||
instance = props.object
|
||||
instance.__instance = true
|
||||
instance.__dispose = instance.dispose
|
||||
} else if (type === 'new') {
|
||||
instance = new props.object(args)
|
||||
} else {
|
||||
@@ -435,6 +437,7 @@ function removeChild(parentInstance: any, child: any) {
|
||||
removeRecursive(child.children, child, true)
|
||||
// Dispose item
|
||||
if (child.dispose) child.dispose()
|
||||
else if (child.__dispose) child.__dispose()
|
||||
// Remove references
|
||||
delete child.__container
|
||||
delete child.__objects
|
||||
|
||||
Reference in New Issue
Block a user