fix(explorer): retry should trigger loading state (#23417)
* fix(explorer): retry should trigger loading state * fix(explorer): Solana ping add refreshing state
This commit is contained in:
parent
3e48cc4e00
commit
7943e8a1c3
|
@ -33,6 +33,7 @@ export type PingInfo = {
|
||||||
|
|
||||||
export enum PingStatus {
|
export enum PingStatus {
|
||||||
Loading,
|
Loading,
|
||||||
|
Refreshing,
|
||||||
Ready,
|
Ready,
|
||||||
Error,
|
Error,
|
||||||
}
|
}
|
||||||
|
@ -124,15 +125,24 @@ export function SolanaPingProvider({ children }: Props) {
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setRollup({
|
setRollup({
|
||||||
status: PingStatus.Error,
|
status: PingStatus.Error,
|
||||||
retry: fetchPingMetrics,
|
retry: () => {
|
||||||
|
setRollup({
|
||||||
|
status: PingStatus.Loading,
|
||||||
|
});
|
||||||
|
|
||||||
|
fetchPingMetrics();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchPingInterval = setInterval(
|
const fetchPingInterval = setInterval(() => {
|
||||||
fetchPingMetrics,
|
setRollup({
|
||||||
FETCH_PING_INTERVAL
|
status: PingStatus.Refreshing,
|
||||||
);
|
});
|
||||||
|
|
||||||
|
fetchPingMetrics();
|
||||||
|
}, FETCH_PING_INTERVAL);
|
||||||
fetchPingMetrics();
|
fetchPingMetrics();
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(fetchPingInterval);
|
clearInterval(fetchPingInterval);
|
||||||
|
|
Loading…
Reference in New Issue