From 4c7e21418c4a98e8958016f10bcd3eb1220d4f7c Mon Sep 17 00:00:00 2001 From: oisupov Date: Fri, 7 Apr 2023 01:16:40 +0700 Subject: [PATCH] Don't show pinning status if autopin is disabled Resolves https://github.com/brave/brave-browser/issues/29553 --- .../desktop/views/portfolio/portfolio-asset.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/brave_wallet_ui/components/desktop/views/portfolio/portfolio-asset.tsx b/components/brave_wallet_ui/components/desktop/views/portfolio/portfolio-asset.tsx index 3eb7757b0c83..4dd263e597fd 100644 --- a/components/brave_wallet_ui/components/desktop/views/portfolio/portfolio-asset.tsx +++ b/components/brave_wallet_ui/components/desktop/views/portfolio/portfolio-asset.tsx @@ -164,6 +164,7 @@ export const PortfolioAsset = (props: Props) => { const selectedCoinMarket = useUnsafePageSelector(PageSelectors.selectedCoinMarket) const nftMetadataError = useSafePageSelector(PageSelectors.nftMetadataError) const nftPinningStatus = useUnsafePageSelector(PageSelectors.nftsPinningStatus) + const isAutoPinEnabled = useSafePageSelector(PageSelectors.isAutoPinEnabled) // queries const { data: assetsNetwork } = useGetNetworkQuery(selectedAsset, { @@ -435,11 +436,14 @@ export const PortfolioAsset = (props: Props) => { }, [nftMetadata]) const currentNftPinningStatus = React.useMemo(() => { + if (!isAutoPinEnabled) { + return undefined + } if (isNftAsset && selectedAsset && nftPinnable) { return getNftPinningStatus(selectedAsset) } return undefined - }, [nftPinnable, isNftAsset, selectedAsset, nftPinningStatus]) + }, [nftPinnable, isNftAsset, selectedAsset, nftPinningStatus, isAutoPinEnabled]) // methods const onClickAddAccount = React.useCallback((tabId: AddAccountNavTypes) => () => { @@ -633,7 +637,7 @@ export const PortfolioAsset = (props: Props) => { sendMessageToNftUiFrame(nftDetailsRef.current.contentWindow, command) } - if (currentNftPinningStatus && nftDetailsRef?.current) { + if (nftDetailsRef?.current) { const command: UpdateNftPinningStatus = { command: NftUiCommand.UpdateNftPinningStatus, payload: {