Skip to content

Commit

Permalink
Auto load lending desks when less than 3 lending desks are available …
Browse files Browse the repository at this point in the history
…to be displayed on QuickLoan
  • Loading branch information
maverickamit committed Oct 17, 2024
1 parent 54d15d6 commit 08def8a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dapp-v1/src/pages/borrower/QuickLoan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ const renderLendingDesks = ({
}
}, [items, loading, error]);

// This useEffect hook automatically loads more lending desks when:
// 1. The current number of lending desks is less than 3
// 2. There are more lending desks available to load
// 3. No loading operation is currently in progress
useEffect(() => {
if (flatResult.length < 3 && hasNextPage && !loading) {
loadMore();
}
}, [flatResult, hasNextPage, loading]);

return (
<div>
{flatResult.length > 0 ? (
Expand Down

0 comments on commit 08def8a

Please sign in to comment.