Skip to content

Commit

Permalink
feat: bail on fetching zapper /apps/balances when accountIds are empty (
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre authored May 6, 2024
1 parent a404f13 commit 898f274
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/StakingVaults/hooks/useFetchOpportunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ export const useFetchOpportunities = () => {
const portfolioAccounts = useSelector(selectPortfolioAccounts)
const DynamicLpAssets = useFeatureFlag('DynamicLpAssets')

const { isLoading: isZapperAppsBalancesOutputLoading } = useGetZapperAppsBalancesOutputQuery()
const { isLoading: isZapperAppsBalancesOutputLoading } = useGetZapperAppsBalancesOutputQuery(
undefined,
{
skip: !requestedAccountIds.length,
},
)
const { isLoading: isZapperUniV2PoolAssetIdsLoading } = useGetZapperUniV2PoolAssetIdsQuery(
undefined,
{ skip: !DynamicLpAssets },
Expand Down
2 changes: 2 additions & 0 deletions src/state/apis/zapper/zapperApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ export const zapper = createApi({

const accountIds = selectWalletAccountIds(state)

if (!accountIds.length) throw new Error('Not ready')

const assets = selectAssets(state)
const evmNetworks = evmChainIds.map(chainIdToZapperNetwork).filter(isSome)

Expand Down

0 comments on commit 898f274

Please sign in to comment.