chore: cleanup
This commit is contained in:
parent
f200518edd
commit
a0e45b463f
|
@ -29,6 +29,7 @@ const Stage = ({
|
||||||
return () => {
|
return () => {
|
||||||
if (renderer) {
|
if (renderer) {
|
||||||
container.removeChild(renderer.element);
|
container.removeChild(renderer.element);
|
||||||
|
renderer.destroy();
|
||||||
}
|
}
|
||||||
if (handle) {
|
if (handle) {
|
||||||
clearInterval(handle);
|
clearInterval(handle);
|
||||||
|
|
|
@ -9,11 +9,15 @@ export default (json) => {
|
||||||
const {Entity} = latus.get('%resources');
|
const {Entity} = latus.get('%resources');
|
||||||
const [entity, setEntity] = useState();
|
const [entity, setEntity] = useState();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (entity) {
|
||||||
|
entity.destroy();
|
||||||
|
}
|
||||||
setEntity();
|
setEntity();
|
||||||
const loadEntity = async () => {
|
const loadEntity = async () => {
|
||||||
setEntity(await Entity.load(json));
|
setEntity(await Entity.load(json));
|
||||||
};
|
};
|
||||||
loadEntity();
|
loadEntity();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [Entity, json]);
|
}, [Entity, json]);
|
||||||
return entity;
|
return entity;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user