Skip to content

Commit

Permalink
Merge pull request #22 from darwinia-network/fix-max-deposit-number
Browse files Browse the repository at this point in the history
Remove unnecessary slicing of the deposit array
  • Loading branch information
1022ranji authored Oct 30, 2024
2 parents 50109b5 + 8c06008 commit d0bb3bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
20 changes: 9 additions & 11 deletions src/components/deposit-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ const DepositList = forwardRef<DepositListRef, DepositListProps>(
{isDepositListLoading ? (
<Loading />
) : depositList?.length ? (
depositList
.slice(0, maxCount)
.map((deposit) => (
<DepositItem
key={deposit.tokenId}
item={deposit}
isChecked={checkedDeposits.includes(deposit)}
symbol={chain?.nativeCurrency?.symbol}
onChange={() => handleDepositChange(deposit)}
/>
))
depositList.map((deposit) => (
<DepositItem
key={deposit.tokenId}
item={deposit}
isChecked={checkedDeposits.includes(deposit)}
symbol={chain?.nativeCurrency?.symbol}
onChange={() => handleDepositChange(deposit)}
/>
))
) : (
<Empty label="No active deposit records" />
)}
Expand Down
22 changes: 10 additions & 12 deletions src/components/unstake-deposit-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,16 @@ const UnstakeDepositList = forwardRef<DepositListRef, DepositListProps>(
const content = (
<>
{deposits?.length ? (
deposits
.slice(0, maxCount)
.map((deposit) => (
<UnstakeDepositItem
key={deposit.tokenId}
item={deposit}
isDisabled={isDisabled}
isChecked={checkedDeposits.includes(deposit)}
symbol={chain?.nativeCurrency?.symbol}
onChange={() => handleDepositChange(deposit)}
/>
))
deposits.map((deposit) => (
<UnstakeDepositItem
key={deposit.tokenId}
item={deposit}
isDisabled={isDisabled}
isChecked={checkedDeposits.includes(deposit)}
symbol={chain?.nativeCurrency?.symbol}
onChange={() => handleDepositChange(deposit)}
/>
))
) : (
<Empty label="No active deposit records" />
)}
Expand Down

0 comments on commit d0bb3bc

Please sign in to comment.