feat(explorer): mission-control resilience, ops token labels, and CI validate
Add SSE reconnect with backoff, fallback REST polling, visibility-aware refresh, extended token-list labels on operations pages, validate-on-pr workflow, and smoke coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
HOME_PRICE_FEED_REFRESH_MS,
|
||||
resolveHomePriceFeedAddresses,
|
||||
} from '@/utils/featuredTokens'
|
||||
import { createVisibilityAwarePoller } from '@/utils/visibilityRefresh'
|
||||
|
||||
type HomeStats = ExplorerStats
|
||||
|
||||
@@ -180,14 +181,11 @@ export default function Home({
|
||||
}, [chainId])
|
||||
|
||||
useEffect(() => {
|
||||
loadDashboard()
|
||||
const timer = window.setInterval(() => {
|
||||
void loadDashboard()
|
||||
}, HOME_DASHBOARD_REFRESH_MS)
|
||||
|
||||
return () => {
|
||||
window.clearInterval(timer)
|
||||
}
|
||||
void loadDashboard()
|
||||
return createVisibilityAwarePoller({
|
||||
intervalMs: HOME_DASHBOARD_REFRESH_MS,
|
||||
task: loadDashboard,
|
||||
})
|
||||
}, [loadDashboard])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -210,7 +208,6 @@ export default function Home({
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
let timer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
const refreshFeaturedPrices = async () => {
|
||||
try {
|
||||
@@ -221,20 +218,18 @@ export default function Home({
|
||||
if (!cancelled && process.env.NODE_ENV !== 'production') {
|
||||
console.warn('Failed to load featured token prices:', error)
|
||||
}
|
||||
} finally {
|
||||
if (!cancelled) {
|
||||
timer = setTimeout(() => {
|
||||
void refreshFeaturedPrices()
|
||||
}, HOME_PRICE_FEED_REFRESH_MS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void refreshFeaturedPrices()
|
||||
const stop = createVisibilityAwarePoller({
|
||||
intervalMs: HOME_PRICE_FEED_REFRESH_MS,
|
||||
task: refreshFeaturedPrices,
|
||||
})
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
if (timer) clearTimeout(timer)
|
||||
stop()
|
||||
}
|
||||
}, [loadFeaturedPrices])
|
||||
|
||||
@@ -307,6 +302,31 @@ export default function Home({
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (relayFeedState !== 'fallback') return
|
||||
|
||||
let cancelled = false
|
||||
|
||||
const refreshSnapshot = async () => {
|
||||
try {
|
||||
const status = await missionControlApi.getBridgeStatus()
|
||||
if (!cancelled) {
|
||||
setBridgeStatus(status)
|
||||
setRelaySummary(summarizeMissionControlRelay(status))
|
||||
}
|
||||
} catch (error) {
|
||||
if (!cancelled && process.env.NODE_ENV !== 'production') {
|
||||
console.warn('Failed to refresh mission control snapshot:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return createVisibilityAwarePoller({
|
||||
intervalMs: HOME_DASHBOARD_REFRESH_MS,
|
||||
task: refreshSnapshot,
|
||||
})
|
||||
}, [relayFeedState])
|
||||
|
||||
const relayToneClasses =
|
||||
relaySummary?.tone === 'danger'
|
||||
? 'border-red-200 bg-red-50 text-red-900 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-100'
|
||||
|
||||
Reference in New Issue
Block a user