Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: appcontext isSnapInstalled checks #7808

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/context/AppProvider/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions src/pages/Accounts/AddAccountModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -73,7 +73,7 @@ export const AddAccountModal = () => {
accountNumber: nextAccountNumber,
chainId,
wallet,
isSnapInstalled,
isSnapInstalled: Boolean(isSnapInstalled),
}),
)
}, [chainIds, isMetaMaskMultichainWallet, isSnapInstalled, nextAccountNumber, wallet])
Expand Down Expand Up @@ -105,7 +105,7 @@ export const AddAccountModal = () => {
accountNumber,
chainIds,
wallet,
isSnapInstalled,
isSnapInstalled: Boolean(isSnapInstalled),
})

const { getAccount } = portfolioApi.endpoints
Expand Down
Loading