fix: race

This commit is contained in:
cha0s 2024-09-24 05:32:43 -05:00
parent 3106788ca7
commit 39e7082a28

View File

@ -22,7 +22,11 @@ export function Time({hour, minute}) {
function ConnectedTime() {
const [hour, setHour] = useState(-1);
const [minute, setMinute] = useState(0);
useEcsTick(useCallback((paylaod, ecs) => {
useEcsTick(useCallback((payload, ecs) => {
const master = ecs.get(1);
if (!master) {
return;
}
const {Time: {hour}} = ecs.get(1);
const wholeHour = Math.floor(hour);
setHour(wholeHour);