Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
fix: show only trades belonging to the current page on fills tab (#456)
Browse files Browse the repository at this point in the history
* Filter out only trades belonging to the current page

* Renamed shownTrades to currentPageTrades
  • Loading branch information
alfetopito authored May 2, 2023
1 parent d8238c8 commit 0224071
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/orders/OrderDetails/FillsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useMemo } from 'react'
import styled, { useTheme } from 'styled-components'
import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons'
import { useNetworkId } from 'state/network'
Expand Down Expand Up @@ -327,6 +327,10 @@ const FillsTable: React.FC<Props> = (props) => {

const invertButton = <Icon icon={faExchangeAlt} onClick={invertPrice} />

const currentPageTrades = useMemo(() => {
return trades?.slice(tableState.pageOffset, tableState.pageOffset + tableState.pageSize)
}, [tableState.pageOffset, tableState.pageSize, trades])

const tradeItems = (items: Trade[] | undefined): JSX.Element => {
if (!items || items.length === 0) {
return (
Expand Down Expand Up @@ -374,7 +378,7 @@ const FillsTable: React.FC<Props> = (props) => {
<th>Execution time</th>
</tr>
}
body={tradeItems(trades)}
body={tradeItems(currentPageTrades)}
/>
</MainWrapper>
)
Expand Down

0 comments on commit 0224071

Please sign in to comment.