chore: cleanup

This commit is contained in:
cha0s 2021-01-26 11:31:14 -06:00
parent f200518edd
commit a0e45b463f
2 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,7 @@ const Stage = ({
return () => {
if (renderer) {
container.removeChild(renderer.element);
renderer.destroy();
}
if (handle) {
clearInterval(handle);

View File

@ -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;
};