File tree 4 files changed +12
-2
lines changed
app/components/OfflineBanner
4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change
1
+ Improve detecting if API is out-of-date
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export const useIsApiReachable = (
24
24
export type FreshnessInfo = {
25
25
unavailable ?: boolean
26
26
outOfDate ?: boolean
27
- outOfDateReason ?: false | 'indexer' | 'blocks'
27
+ outOfDateReason ?: false | 'indexer' | 'blocks' | 'node'
28
28
lastUpdate ?: string
29
29
latestBlock ?: number
30
30
}
@@ -96,7 +96,12 @@ export const useConsensusFreshness = (
96
96
97
97
const blockInterval = 6 * 1000
98
98
const blocksAreBehindNode = data . latest_node_block > data . latest_block + outOfDateThreshold / blockInterval
99
- const outOfDateReason = blocksAreBehindNode ? 'blocks' : freshness . outOfDateReason
99
+ const nodeIsOutOfDate = freshness . outOfDate && data . latest_node_block === data . latest_block
100
+ const outOfDateReason = blocksAreBehindNode
101
+ ? 'blocks'
102
+ : nodeIsOutOfDate
103
+ ? 'node'
104
+ : freshness . outOfDateReason
100
105
return {
101
106
...freshness ,
102
107
outOfDate : outOfDateReason === undefined ? undefined : ! ! outOfDateReason ,
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ export const OfflineBanner: FC<OfflineBannerProps> = props => {
55
55
// Don't display lastUpdate. It's updating, but still many blocks behind.
56
56
return < StickyAlert severity = "warning" > { t ( 'home.indexerOutOfDate' , { scope } ) } </ StickyAlert >
57
57
}
58
+ if ( outOfDateReason === 'node' ) {
59
+ return < StickyAlert severity = "warning" > { t ( 'home.nodeOutOfDateSince' , { scope, lastUpdate } ) } </ StickyAlert >
60
+ }
58
61
exhaustedTypeWarning ( 'Unexpected outOfDateReason' , outOfDateReason )
59
62
return < StickyAlert severity = "warning" > { t ( 'home.indexerOutOfDate' , { scope } ) } </ StickyAlert >
60
63
}
Original file line number Diff line number Diff line change 624
624
"userOffline" : " You are offline. We’re trying to reconnect" ,
625
625
"indexerOutOfDate" : " We don't have fully up-to-date data about our {{ scope }}. The data displayed here might be out of date." ,
626
626
"indexerOutOfDateSince" : " The last update we have about our {{ scope }} is from {{ lastUpdate }}. The data displayed here might be out of date." ,
627
+ "nodeOutOfDateSince" : " The explorer's gRPC node has not observed new blocks since {{ lastUpdate }}. Check status.oasis.io." ,
627
628
"indexerUnavailable" : " Data about {{ scope }} is currently not available. Please check back later." ,
628
629
"blocks" : " Blocks" ,
629
630
"exploreBtnText" : " Explore Oasis" ,
You can’t perform that action at this time.
0 commit comments