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