Skip to content

Commit

Permalink
Reset Page counter on Search Query in Balances
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshpw committed Oct 20, 2024
1 parent aaf10dd commit d650d2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/explorer/pages/Treasury/components/BalancesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const titleDataMatcher = (title: (typeof titles)[number], rowData: RowData) => {

interface TableProps {
rows: RowData[]
searchText?: string
tezosBalance: BigNumber
openXTZTransferModal: () => void
openTokenTransferModal: (tokenAddress: string) => void
Expand All @@ -112,6 +113,7 @@ interface TableProps {

const BalancesList: React.FC<TableProps> = ({
rows,
searchText,
tezosBalance,
openTokenTransferModal,
openXTZTransferModal,
Expand All @@ -127,6 +129,13 @@ const BalancesList: React.FC<TableProps> = ({
setList(rows)
}, [rows])

useEffect(() => {
if (searchText && searchText.length > 0) {
setOffset(0)
setCurrentPage(0)
}
}, [searchText])

// useEffect(() => {
// if (list) {
// const val = list.findIndex(row => row.symbol === "XTZ")
Expand Down Expand Up @@ -388,6 +397,7 @@ export const BalancesTable: React.FC = () => {
</Grid>
<BalancesList
rows={rows}
searchText={searchText}
tezosBalance={tezosBalance || new BigNumber(0)}
openTokenTransferModal={onOpenTokenTransferModal}
openXTZTransferModal={onOpenXTZTransferModal}
Expand Down

0 comments on commit d650d2d

Please sign in to comment.