From 495c762b6cd89ef7280bde8ab30c9b104d67d23c Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 28 Jun 2023 11:46:48 +0200 Subject: [PATCH] Freshness test: look at latest block time, not latest update --- .changelog/611.bugfix.md | 1 + src/app/components/OfflineBanner/hook.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .changelog/611.bugfix.md diff --git a/.changelog/611.bugfix.md b/.changelog/611.bugfix.md new file mode 100644 index 000000000..7ed45fbdf --- /dev/null +++ b/.changelog/611.bugfix.md @@ -0,0 +1 @@ +Freshness test: look at latest block time, not latest update diff --git a/src/app/components/OfflineBanner/hook.ts b/src/app/components/OfflineBanner/hook.ts index 9183e26f1..dd1130848 100644 --- a/src/app/components/OfflineBanner/hook.ts +++ b/src/app/components/OfflineBanner/hook.ts @@ -25,7 +25,7 @@ export const useRuntimeFreshness = (scope: SearchScope): FreshnessInfo => { throw new AppError(AppErrors.UnsupportedLayer) } const query = useGetRuntimeStatus(scope.network, scope.layer) - const timeDistance = useFormattedTimestampString(query?.data?.data.latest_update) + const timeDistance = useFormattedTimestampString(query?.data?.data.latest_block_time) if (query.isLoading) { return { outOfDate: undefined, @@ -51,7 +51,7 @@ export const useRuntimeFreshness = (scope: SearchScope): FreshnessInfo => { outOfDate: true, } } - const timeSinceLastUpdate = query.dataUpdatedAt - new Date(data.latest_update).getTime() + const timeSinceLastUpdate = query.dataUpdatedAt - new Date(data.latest_block_time).getTime() const { outOfDateThreshold } = paraTimesConfig[scope.layer] return { outOfDate: timeSinceLastUpdate > outOfDateThreshold,