Skip to content

Commit

Permalink
Merge pull request #702 from dappforce/fix/cache
Browse files Browse the repository at this point in the history
If enable wallet is broken while in iframe and using pjs
  • Loading branch information
teodorus-nathaniel authored Aug 30, 2024
2 parents fb05a15 + 0e123f8 commit 9f1c74a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/pages/api/accounts-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ async function fetchAccountsData(addresses: string[], method: 'POST' | 'GET') {
)
}

const domains = await getEnsNames(evmAddressesHuman)
let domains: Record<string, string[]> = {}
try {
domains = await getEnsNames(evmAddressesHuman)
} catch (err) {
console.error('Error fetching ENS names', err)
}

const needToFetchIdsPromise = addresses.map(async (address, i) => {
const evmAddress = evmAddressesHuman[i]
Expand Down
11 changes: 10 additions & 1 deletion src/stores/my-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { waitNewBlock } from '@/utils/blockchain'
import { currentNetwork } from '@/utils/network'
import { wait } from '@/utils/promise'
import { LocalStorage, LocalStorageAndForage } from '@/utils/storage'
import { isWebNotificationsEnabled } from '@/utils/window'
import { getIsInIframe, isWebNotificationsEnabled } from '@/utils/window'
import { Wallet, WalletAccount, getWallets } from '@talismn/connect-wallets'
import dayjs from 'dayjs'
import toast from 'react-hot-toast'
Expand Down Expand Up @@ -635,6 +635,15 @@ export async function enableWallet({
if (typeof unsub === 'function') unsub()
}
} catch (err) {
if (getIsInIframe() && preferredWallet.title === 'Polkadot.js') {
toast.custom((t) => (
<Toast
t={t}
title='Please retry this action in "Chat" page'
description='Click on "Chat" menu in the sidebar and retry your action in that page'
/>
))
}
console.error('Error enabling wallet', err)
onError(err)
}
Expand Down

0 comments on commit 9f1c74a

Please sign in to comment.