Skip to content

Commit

Permalink
Refactor updateAddedTokens to simplify token filtering logic (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
trungbach authored Jan 12, 2025
1 parent 53b8f85 commit ac79af2
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/reducer/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ export const tokenSlice = createSlice({
updateAddedTokens: (state, action: PayloadAction<any>) => {
state.addedTokens = [
...state.addedTokens,
...action.payload.filter(
(token: TokenItemType) =>
!state.addedTokens.find((t) => t?.denom === token?.denom || t?.contractAddress === token?.contractAddress)
)
...action.payload.filter((token: TokenItemType) => !state.addedTokens.find((t) => t?.denom === token?.denom))
];
}
}
Expand Down

0 comments on commit ac79af2

Please sign in to comment.