Skip to content

Commit 6b9d15f

Browse files
authored
Merge pull request #4824 from raltunel/infinite-scroll/use-ref-on-fetched-txs
Change LastRowRef on TableRows according to new client side filtering
2 parents 65b3be4 + be9dee5 commit 6b9d15f

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/components/Trade/InfiniteScroll/InfiniteScroll.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ function InfiniteScroll(props: propsIF) {
334334

335335
const newTxData: LimitOrderIF[] | PositionIF[] | TransactionIF[] = [];
336336

337-
let oldestTimeParam = getOldestTime(fetchedTransactions);
337+
let oldestTimeParam = getOldestTime(
338+
fetchedTransactionsRef.current || fetchedTransactions,
339+
);
338340

339341
// ------------------- FETCH DATA WITH LOOP -------------------
340342
while (addedDataCount < targetCount) {

src/components/Trade/InfiniteScroll/TableRowsInfiniteScroll.tsx

+22-1
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,35 @@ function TableRowsInfiniteScroll({
9191
return /iPad|iPhone|iPod/.test(userAgent);
9292
};
9393

94+
const debugMode = false;
95+
96+
// // added to debug infinite scroll on monadTestnet link
97+
// // can be removed after detecting issue
98+
// const [debugMode, setDebugMode] = useState(false);
99+
// const debugModeRef = useRef<boolean>();
100+
// debugModeRef.current = debugMode;
101+
102+
// const [shortcutAdded, setShortcutAdded] = useState(false);
103+
104+
// useEffect(() => {
105+
// document.addEventListener('keydown', (e) => {
106+
// if (
107+
// (e.shiftKey && e.altKey && e.key === 'j') ||
108+
// (e.shiftKey && e.altKey && e.key === 'J')
109+
// ) {
110+
// setDebugMode(!debugModeRef.current);
111+
// }
112+
// });
113+
// setShortcutAdded(true);
114+
// }, [shortcutAdded == false]);
115+
94116
const isSmallScreen: boolean = useMediaQuery('(max-width: 768px)');
95117

96118
const wrapperID = tableKey ? tableKey : '';
97119

98120
const txSpanSelectorForScrollMethod = `#infinite_scroll_wrapper_${wrapperID} div[data-label='hidden-id'] > span`;
99121
const txSpanSelectorForBindMethod = 'div[data-label="hidden-id"]';
100122

101-
const debugMode = false;
102123
const markRows = false;
103124
const [manualMode, setManualMode] = useState(false);
104125
const manualModeRef = useRef<boolean>();

src/components/Trade/TradeTabs/TableRows.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function TableRows({
217217
observedRowRef={
218218
idx === 0
219219
? firstRowRef
220-
: idx === data.length - 1
220+
: idx === txDataToDisplay.length - 1
221221
? lastRowRef
222222
: undefined
223223
}

0 commit comments

Comments
 (0)