From b73292b97e9be7b8135fa8ef17f41169d5a6acd1 Mon Sep 17 00:00:00 2001 From: lingniu Date: Fri, 3 Jul 2026 23:01:01 +0800 Subject: [PATCH] feat(platform): poll topbar link health --- vehicle-data-platform/apps/web/src/App.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/App.tsx b/vehicle-data-platform/apps/web/src/App.tsx index 133def83..3680cfb2 100644 --- a/vehicle-data-platform/apps/web/src/App.tsx +++ b/vehicle-data-platform/apps/web/src/App.tsx @@ -15,17 +15,25 @@ export default function App() { const [activeVin, setActiveVin] = useState('LB9A32A24R0LS1426'); const [linkIssueCount, setLinkIssueCount] = useState(null); - const refreshOpsHealth = useCallback(() => { + const refreshOpsHealth = useCallback((showError = true) => { return api.opsHealth() .then((health) => { setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length); return health; }) - .catch((error: Error) => Toast.error(error.message)); + .catch((error: Error) => { + if (showError) { + Toast.error(error.message); + } + }); }, []); useEffect(() => { refreshOpsHealth(); + const timer = window.setInterval(() => { + refreshOpsHealth(false); + }, 60000); + return () => window.clearInterval(timer); }, [refreshOpsHealth]); const openVehicle = (vin: string) => {