dev: better crash report
This commit is contained in:
parent
b5019153f3
commit
f328ce4ccb
|
@ -232,12 +232,18 @@ function Ui({disconnected}) {
|
|||
]);
|
||||
usePacket('EcsChange', onEcsChangePacket);
|
||||
const onTickPacket = useCallback(async (payload, client) => {
|
||||
if (0 === Object.keys(payload.ecs).length) {
|
||||
if (!ecsRef.current || 0 === Object.keys(payload.ecs).length) {
|
||||
return;
|
||||
}
|
||||
latestTick.current = Promise.resolve(latestTick.current).then(async () => {
|
||||
try {
|
||||
await ecsRef.current.apply(payload.ecs);
|
||||
client.emitter.invoke(':Ecs', payload.ecs);
|
||||
}
|
||||
catch (error) {
|
||||
ecsRef.current = undefined;
|
||||
console.error('tick crash', error);
|
||||
}
|
||||
});
|
||||
}, [ecsRef]);
|
||||
usePacket('Tick', onTickPacket);
|
||||
|
@ -361,7 +367,7 @@ function Ui({disconnected}) {
|
|||
};
|
||||
}, []);
|
||||
const computePosition = useCallback(({clientX, clientY}) => {
|
||||
if (!gameRef.current || !mainEntityRef.current) {
|
||||
if (!gameRef.current || !mainEntityRef.current || !ecsRef.current) {
|
||||
return;
|
||||
}
|
||||
const {top, left, width} = gameRef.current.getBoundingClientRect();
|
||||
|
|
Loading…
Reference in New Issue
Block a user