From b1bbb76a387b2f5e1dc118f2e6dc6ce788f3632c Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Thu, 26 Sep 2024 00:48:19 +0200 Subject: [PATCH] fix: appcontext isSnapInstalled checks (#7808) * fix: appcontext isSnapInstalled checks * feat: tackle last occurence --- src/context/AppProvider/AppContext.tsx | 9 +++++++-- src/pages/Accounts/AddAccountModal.tsx | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/context/AppProvider/AppContext.tsx b/src/context/AppProvider/AppContext.tsx index e031742ecc5..5ebc09e7679 100644 --- a/src/context/AppProvider/AppContext.tsx +++ b/src/context/AppProvider/AppContext.tsx @@ -63,7 +63,7 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => { const portfolioLoadingStatus = useSelector(selectPortfolioLoadingStatus) const portfolioAssetIds = useSelector(selectPortfolioAssetIds) const routeAssetId = useRouteAssetId() - const isSnapInstalled = Boolean(useIsSnapInstalled()) + const { isSnapInstalled } = useIsSnapInstalled() const previousIsSnapInstalled = usePrevious(isSnapInstalled) const { close: closeModal, open: openModal } = useModal('ledgerOpenApp') @@ -180,7 +180,12 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => { ) break - const input = { accountNumber, chainIds, wallet, isSnapInstalled } + const input = { + accountNumber, + chainIds, + wallet, + isSnapInstalled: Boolean(isSnapInstalled), + } const accountIdsAndMetadata = await deriveAccountIdsAndMetadata(input) const accountIds = Object.keys(accountIdsAndMetadata) diff --git a/src/pages/Accounts/AddAccountModal.tsx b/src/pages/Accounts/AddAccountModal.tsx index 0647ce04d24..92c8dd0b30e 100644 --- a/src/pages/Accounts/AddAccountModal.tsx +++ b/src/pages/Accounts/AddAccountModal.tsx @@ -60,7 +60,7 @@ export const AddAccountModal = () => { selectMaybeNextAccountNumberByChainId(s, filter), ) - const isSnapInstalled = Boolean(useIsSnapInstalled()) + const { isSnapInstalled } = useIsSnapInstalled() const isMetaMaskMultichainWallet = wallet instanceof MetaMaskShapeShiftMultiChainHDWallet const unsupportedSnapChainIds = useMemo(() => { @@ -73,7 +73,7 @@ export const AddAccountModal = () => { accountNumber: nextAccountNumber, chainId, wallet, - isSnapInstalled, + isSnapInstalled: Boolean(isSnapInstalled), }), ) }, [chainIds, isMetaMaskMultichainWallet, isSnapInstalled, nextAccountNumber, wallet]) @@ -105,7 +105,7 @@ export const AddAccountModal = () => { accountNumber, chainIds, wallet, - isSnapInstalled, + isSnapInstalled: Boolean(isSnapInstalled), }) const { getAccount } = portfolioApi.endpoints