Skip to content

Commit

Permalink
fix: appcontext isSnapInstalled checks (#7808)
Browse files Browse the repository at this point in the history
* fix: appcontext isSnapInstalled checks

* feat: tackle last occurence
  • Loading branch information
gomesalexandre authored Sep 25, 2024
1 parent a6d3a38 commit b1bbb76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit b1bbb76

Please sign in to comment.