From dcd49933442d70280a69edb677816baabbed6bbd Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 9 Aug 2023 15:36:17 +0700 Subject: [PATCH] fix dont favorite when remove import token --- src/components/SearchModal/CurrencySearch.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/SearchModal/CurrencySearch.tsx b/src/components/SearchModal/CurrencySearch.tsx index 7a77c1bdfa..7a5cc0acef 100644 --- a/src/components/SearchModal/CurrencySearch.tsx +++ b/src/components/SearchModal/CurrencySearch.tsx @@ -385,13 +385,13 @@ export function CurrencySearch({ const removeImportedToken = useCallback( (token: Token) => { removeToken(chainId, token.address) - - toggleFavoriteToken({ - chainId, - address: token.address, - }) + if (favoriteTokens?.some(el => el.toLowerCase() === token.address.toLowerCase())) + toggleFavoriteToken({ + chainId, + address: token.address, + }) }, - [chainId, toggleFavoriteToken, removeToken], + [chainId, toggleFavoriteToken, removeToken, favoriteTokens], ) const removeAllImportToken = () => {