force refresh client wallets when device sync is enabled

This commit is contained in:
Riccardo Balbo 2024-10-18 18:40:06 +02:00 committed by k00b
parent 00c047f09b
commit fdc3df9c15
2 changed files with 6 additions and 1 deletions

View File

@ -10,9 +10,11 @@ import CancelButton from './cancel-button'
import * as yup from 'yup'
import { deviceSyncSchema } from '@/lib/validate'
import RefreshIcon from '@/svgs/refresh-line.svg'
import { useApolloClient } from '@apollo/client'
export default function DeviceSync () {
const { me } = useMe()
const apollo = useApolloClient()
const [value, setVaultKey, clearVault, disconnectVault] = useVaultConfigurator()
const showModal = useShowModal()
@ -105,6 +107,9 @@ export default function DeviceSync () {
try {
await setVaultKey(values.passphrase)
await migrate()
apollo.cache.evict({ fieldName: 'BestWallets' })
apollo.cache.gc()
await apollo.refetchQueries({ include: ['BestWallets'] })
} catch (e) {
formik?.setErrors({ passphrase: e.message })
throw e

View File

@ -209,7 +209,7 @@ export const BEST_WALLETS = gql`
}
`
export const BEST_SEND_WALLETS = gql`
query BestWallets {
query BestSendWallets {
wallets (includeSenders: true, includeReceivers: false, onlyEnabled: true, prioritySort: "asc") {
id
priority