Skip to content

Commit

Permalink
Remove unnecessary slicing of the deposit array
Browse files Browse the repository at this point in the history
  • Loading branch information
snoopy1412 committed Oct 30, 2024
1 parent 50109b5 commit 8c06008
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 8c06008

Please sign in to comment.