Skip to content

Commit

Permalink
Fix variable names in useRuntimeFreshness
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Aug 22, 2023
1 parent aa9e86a commit 1bf1d5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/811.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix variable names in useRuntimeFreshness
9 changes: 4 additions & 5 deletions src/app/components/OfflineBanner/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ 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_block_time)
const data = query.data?.data
const lastUpdate = useFormattedTimestampString(data?.latest_block_time)

if (query.isError) {
return {
Expand All @@ -48,14 +49,12 @@ export const useRuntimeFreshness = (scope: SearchScope): FreshnessInfo => {
outOfDate: false,
}
}
const data = query.data?.data
if (!query.isSuccess || !data) {
return {
outOfDate: true,
}
}
const { latest_block } = data
if (latest_block === -1) {
if (data.latest_block === -1) {
return {
outOfDate: true,
}
Expand All @@ -64,6 +63,6 @@ export const useRuntimeFreshness = (scope: SearchScope): FreshnessInfo => {
const { outOfDateThreshold } = paraTimesConfig[scope.layer]
return {
outOfDate: timeSinceLastUpdate > outOfDateThreshold,
lastUpdate: timeDistance,
lastUpdate: lastUpdate,
}
}

0 comments on commit 1bf1d5c

Please sign in to comment.