Skip to content

Commit 05099d5

Browse files
committed
attempt to reduce memory footprint by only displaying top 100 transactions in trade table
1 parent 5279669 commit 05099d5

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

src/components/Trade/TradeTabs/TableRows.tsx

+10-13
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ interface propsIF {
2424
fullData: TransactionIF[] | LimitOrderIF[] | PositionIF[];
2525
tableView: 'small' | 'medium' | 'large';
2626
isAccountView: boolean;
27-
isLeaderboard?: boolean;
28-
positionsByApy?: string[];
2927
firstRowRef?: MutableRefObject<HTMLDivElement | null>;
3028
lastRowRef?: MutableRefObject<HTMLDivElement | null>;
3129
}
@@ -38,11 +36,16 @@ function TableRows({
3836
fullData,
3937
isAccountView,
4038
tableView,
41-
isLeaderboard,
42-
positionsByApy,
4339
firstRowRef,
4440
lastRowRef,
4541
}: propsIF) {
42+
// console.log({
43+
// dataLength: data.length,
44+
// type,
45+
// fullDataLength: fullData.length,
46+
// firstRowRef,
47+
// lastRowRef,
48+
// });
4649
const [isDetailsModalOpen, openDetailsModal, closeDetailsModal] =
4750
useModal();
4851

@@ -164,13 +167,6 @@ function TableRows({
164167
}
165168
tableView={tableView}
166169
isAccountView={isAccountView}
167-
isLeaderboard={isLeaderboard}
168-
rank={
169-
positionsByApy
170-
? positionsByApy.indexOf(position.positionId) +
171-
1
172-
: undefined
173-
}
174170
openDetailsModal={() =>
175171
openRangeModal(position.positionId, 'details')
176172
}
@@ -199,11 +195,12 @@ function TableRows({
199195
);
200196
};
201197

198+
const txDataToDisplay = isAccountView ? data : data.slice(0, 100);
199+
202200
const transactionContent = () => {
203201
return (
204202
<>
205-
{/* <div id='omega'>OMEGA</div> */}
206-
{(data as TransactionIF[]).map((tx, idx) => (
203+
{(txDataToDisplay as TransactionIF[]).map((tx, idx) => (
207204
<TransactionRow
208205
key={idx}
209206
idForDOM={`tx_row_${idx}`}

src/components/Trade/TradeTabs/TradeTabs2.tsx

+18-18
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,24 @@ function TradeTabs2(props: propsIF) {
121121
},
122122
]
123123
: [
124-
// {
125-
// label: 'Transactions',
126-
// content: <Transactions {...transactionsProps} />,
127-
// icon: recentTransactionsImage,
128-
// showRightSideOption: true,
129-
// },
130-
// {
131-
// label: 'Limits',
132-
// content: <Orders {...ordersProps} />,
133-
// icon: openOrdersImage,
134-
// showRightSideOption: true,
135-
// },
136-
// {
137-
// label: 'Liquidity',
138-
// content: <Ranges {...rangesProps} />,
139-
// icon: rangePositionsImage,
140-
// showRightSideOption: true,
141-
// },
124+
{
125+
label: 'Transactions',
126+
content: <Transactions {...transactionsProps} />,
127+
icon: recentTransactionsImage,
128+
showRightSideOption: true,
129+
},
130+
{
131+
label: 'Limits',
132+
content: <Orders {...ordersProps} />,
133+
icon: openOrdersImage,
134+
showRightSideOption: true,
135+
},
136+
{
137+
label: 'Liquidity',
138+
content: <Ranges {...rangesProps} />,
139+
icon: rangePositionsImage,
140+
showRightSideOption: true,
141+
},
142142
{
143143
label: 'Info',
144144
content: <TableInfo />,

0 commit comments

Comments
 (0)