mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Re-set fetchOrder on page change, empty book on not_found
This commit is contained in:
parent
af3007bbf4
commit
8ae259e143
@ -112,7 +112,6 @@ export const FederationContextProvider = ({
|
|||||||
let newDelay = defaultDelay;
|
let newDelay = defaultDelay;
|
||||||
if (order?.bad_request) {
|
if (order?.bad_request) {
|
||||||
newDelay = 99999999;
|
newDelay = 99999999;
|
||||||
console.log('bad request on order, new delay', newDelay);
|
|
||||||
setBadOrder(order.bad_request);
|
setBadOrder(order.bad_request);
|
||||||
garage.updateOrder(null);
|
garage.updateOrder(null);
|
||||||
}
|
}
|
||||||
@ -123,11 +122,10 @@ export const FederationContextProvider = ({
|
|||||||
? statusToDelay[order.status]
|
? statusToDelay[order.status]
|
||||||
: statusToDelay[order.status] * 5 // If user is not looking at "order" tab, refresh less often.
|
: statusToDelay[order.status] * 5 // If user is not looking at "order" tab, refresh less often.
|
||||||
: 99999999;
|
: 99999999;
|
||||||
console.log('has order id, new delay is', newDelay);
|
|
||||||
garage.updateOrder(order);
|
garage.updateOrder(order);
|
||||||
setBadOrder(undefined);
|
setBadOrder(undefined);
|
||||||
}
|
}
|
||||||
console.log('setting delay!', newDelay);
|
clearInterval(timer);
|
||||||
setDelay(newDelay);
|
setDelay(newDelay);
|
||||||
setTimer(setTimeout(fetchCurrentOrder, newDelay));
|
setTimer(setTimeout(fetchCurrentOrder, newDelay));
|
||||||
};
|
};
|
||||||
@ -141,7 +139,7 @@ export const FederationContextProvider = ({
|
|||||||
onOrderReceived(order as Order);
|
onOrderReceived(order as Order);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('Hit no order, delay', defaultDelay);
|
clearInterval(timer);
|
||||||
setTimer(setTimeout(fetchCurrentOrder, defaultDelay));
|
setTimer(setTimeout(fetchCurrentOrder, defaultDelay));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -149,11 +147,10 @@ export const FederationContextProvider = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
fetchCurrentOrder();
|
fetchCurrentOrder();
|
||||||
setDelay(defaultDelay);
|
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
};
|
};
|
||||||
}, [coordinatorUpdatedAt, federationUpdatedAt]);
|
}, [page]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (page === 'offers') void federation.updateBook();
|
if (page === 'offers') void federation.updateBook();
|
||||||
|
@ -193,6 +193,9 @@ export class Coordinator {
|
|||||||
});
|
});
|
||||||
void this.generateAllMakerAvatars(data);
|
void this.generateAllMakerAvatars(data);
|
||||||
onDataLoad();
|
onDataLoad();
|
||||||
|
} else {
|
||||||
|
this.book = [];
|
||||||
|
onDataLoad();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user