Skip to content

Commit 3523f81

Browse files
fix: query errors
1 parent 47fcfa2 commit 3523f81

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

apps/main/src/lend/hooks/useBorrowPositionDetails.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,19 @@ export const useBorrowPositionDetails = ({
3434
}: UseBorrowPositionDetailsProps): BorrowPositionDetailsProps => {
3535
const { controller } = market?.addresses ?? {}
3636
const { address: userAddress } = useAccount()
37-
const { data: userLoanDetails, isLoading: isUserLoanDetailsLoading } = useUserLoanDetails({
37+
const { data: loanExists } = useLoanExists({
3838
chainId,
3939
marketId,
4040
userAddress,
4141
})
42+
const { data: userLoanDetails, isLoading: isUserLoanDetailsLoading } = useUserLoanDetails(
43+
{
44+
chainId,
45+
marketId,
46+
userAddress,
47+
},
48+
!!loanExists,
49+
)
4250
const {
4351
bands,
4452
health,
@@ -49,11 +57,6 @@ export const useBorrowPositionDetails = ({
4957
state: { collateral, borrowed, debt } = {},
5058
} = userLoanDetails ?? {}
5159
const prices = useStore((state) => state.markets.pricesMapper[chainId]?.[marketId])
52-
const { data: loanExists } = useLoanExists({
53-
chainId,
54-
marketId,
55-
userAddress,
56-
})
5760
const { data: userPnl, isLoading: isUserPnlLoading } = useUserPnl({
5861
chainId,
5962
marketId,

0 commit comments

Comments
 (0)