Skip to content

Commit

Permalink
feat(unlock-app): not loading crosschain routes for extensions (#14075)
Browse files Browse the repository at this point in the history
not loading crosschain routes for extensions
  • Loading branch information
julien51 committed Jun 19, 2024
1 parent 55f1a43 commit 92bf42c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions unlock-app/src/hooks/useCrossChainRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export const useCrossChainRoutes = ({
}
)

const hasPrices = Array.isArray(prices) && prices.length > 0

const balanceResults = useQueries({
queries: BoxEvmChains.filter((network) => {
return networks[network.id]
Expand All @@ -82,7 +84,7 @@ export const useCrossChainRoutes = ({
}
},
staleTime: 1000 * 60 * 5, // 5 minutes
enabled,
enabled: enabled && hasPrices,
}
}),
})
Expand Down Expand Up @@ -196,7 +198,7 @@ export const useCrossChainRoutes = ({
...route,
} as CrossChainRouteWithBalance
},
enabled,
enabled: enabled && hasPrices,
staleTime: 1000 * 60 * 5, // 5 minutes
}
}
Expand All @@ -212,8 +214,8 @@ export const useCrossChainRoutes = ({
return {
isLoading:
isLoadingPrices ||
balanceResults.some((result) => result.isLoading) ||
routeResults.some((result) => result.isLoading),
(hasPrices && balanceResults.some((result) => result.isLoading)) ||
(hasPrices && routeResults.some((result) => result.isLoading)),
routes: routes.sort(
(a: CrossChainRouteWithBalance, b: CrossChainRouteWithBalance) =>
a!.resolvedAt - b!.resolvedAt
Expand Down

0 comments on commit 92bf42c

Please sign in to comment.