Skip to content

Commit

Permalink
Merge pull request #4300 from raltunel/infinite-scroll/txs
Browse files Browse the repository at this point in the history
Infinite scroll - fix Transactions
  • Loading branch information
benwolski authored Nov 9, 2024
2 parents 059ce75 + 7fcad48 commit 3027dd8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/components/Trade/TradeTabs/Transactions/Transactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function Transactions(props: propsIF) {
transactionsByPool,
unindexedNonFailedSessionTransactionHashes,
} = useContext<GraphDataContextIF>(GraphDataContext);

const { transactionsByType } = useContext<ReceiptContextIF>(ReceiptContext);
const { baseToken, quoteToken } =
useContext<TradeDataContextIF>(TradeDataContext);
Expand Down Expand Up @@ -228,13 +229,25 @@ function Transactions(props: propsIF) {

useEffect(() => {
// clear fetched transactions when switching pools
if (transactionsByPool.changes.length === 0) {
if (!isAccountView && showAllData && transactionsByPool.changes.length === 0) {
setFetchedTransactions({
dataReceived: true,
changes: [],
});
}
else if(!isAccountView && !showAllData && userAddressRef.current && userTransactionsByPool.changes.length === 0){
setFetchedTransactions({
dataReceived: true,
changes: [],
});
}
else if(isAccountView && (accountAddressRef.current || userAddressRef.current) && activeAccountTransactionData?.length === 0){
setFetchedTransactions({
dataReceived: true,
changes: [],
});
}
}, [transactionsByPool.changes]);
}, [transactionsByPool.changes, userTransactionsByPool.changes, activeAccountTransactionData]);

// const [showInfiniteScroll, setShowInfiniteScroll] = useState<boolean>(!isAccountView && showAllData);
// useEffect(() => {
Expand Down

0 comments on commit 3027dd8

Please sign in to comment.