fix: race
This commit is contained in:
parent
3106788ca7
commit
39e7082a28
|
@ -22,7 +22,11 @@ export function Time({hour, minute}) {
|
||||||
function ConnectedTime() {
|
function ConnectedTime() {
|
||||||
const [hour, setHour] = useState(-1);
|
const [hour, setHour] = useState(-1);
|
||||||
const [minute, setMinute] = useState(0);
|
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 {Time: {hour}} = ecs.get(1);
|
||||||
const wholeHour = Math.floor(hour);
|
const wholeHour = Math.floor(hour);
|
||||||
setHour(wholeHour);
|
setHour(wholeHour);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user