Skip to content

Commit

Permalink
Merge branch 'main' into improve-swap
Browse files Browse the repository at this point in the history
  • Loading branch information
atn4z7 authored Jan 31, 2025
2 parents 123eef6 + 14ee45c commit 9b1d928
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Avatar from 'components/Avatar'
import { useDispatch, useSelector } from 'react-redux'
import { selectTokenVisibility, toggleTokenVisibility } from 'store/portfolio'
import { MaliciousTokenIconWithWarning } from 'components/MaliciousTokenIconWithWarning'
import { isTokenVisible } from 'store/balance/utils'

type Props = {
id: string
Expand All @@ -28,8 +29,7 @@ const TokenManagementItem: FC<Props> = ({

const tokenVisibility = useSelector(selectTokenVisibility)

const isSwitchOn =
tokenVisibility[id] !== undefined ? tokenVisibility[id] : !isMalicious
const isSwitchOn = isTokenVisible(tokenVisibility[id], isMalicious)

function handleChange(): void {
dispatch(toggleTokenVisibility({ tokenId: id, value: !isSwitchOn }))
Expand Down
2 changes: 1 addition & 1 deletion packages/core-mobile/app/store/balance/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export function isTokenVisible(
tokenVisible: boolean | undefined,
isMalicious: boolean
): boolean {
return tokenVisible === true || (tokenVisible === undefined && !isMalicious)
return tokenVisible !== undefined ? tokenVisible : !isMalicious
}

0 comments on commit 9b1d928

Please sign in to comment.