diff --git a/.changelog/1585.bugfix.md b/.changelog/1585.bugfix.md new file mode 100644 index 000000000..0a8808f30 --- /dev/null +++ b/.changelog/1585.bugfix.md @@ -0,0 +1 @@ +Ignore all account name fetching errors at the same level diff --git a/src/app/data/oasis-account-names.ts b/src/app/data/oasis-account-names.ts index 00200a308..b5e7fee7d 100644 --- a/src/app/data/oasis-account-names.ts +++ b/src/app/data/oasis-account-names.ts @@ -62,7 +62,7 @@ const getOasisAccountsMetadata = async (network: Network, layer: Layer): Promise } } -export const useOasisAccountsMetadata = ( +const useOasisAccountsMetadata = ( network: Network, layer: Layer, queryOptions: UseQueryOptions, @@ -101,7 +101,7 @@ export const useSearchForOasisAccountsByName = ( isError: isMetadataError, error: metadataError, data: namedAccounts, - } = useOasisAccountsMetadata(network, layer, { useErrorBoundary: false, ...queryOptions }) + } = useOasisAccountsMetadata(network, layer, queryOptions) if (isMetadataError) { console.log('Failed to load Oasis account metadata', metadataError) } diff --git a/src/app/data/pontusx-account-names.ts b/src/app/data/pontusx-account-names.ts index 934ac5757..799b189c9 100644 --- a/src/app/data/pontusx-account-names.ts +++ b/src/app/data/pontusx-account-names.ts @@ -78,7 +78,7 @@ export const useSearchForPontusXAccountsByName = ( isError: isMetadataError, error: metadataError, data: namedAccounts, - } = usePontusXAccountsMetadata({ useErrorBoundary: false, ...queryOptions }) + } = usePontusXAccountsMetadata(queryOptions) if (isMetadataError) { console.log('Failed to load Pontus-X account names', metadataError) } diff --git a/src/app/hooks/useAccountMetadata.ts b/src/app/hooks/useAccountMetadata.ts index c8dc4659d..b71e9c439 100644 --- a/src/app/hooks/useAccountMetadata.ts +++ b/src/app/hooks/useAccountMetadata.ts @@ -10,17 +10,23 @@ import { getOasisAddress } from '../utils/helpers' * * This is the entry point that should be used by the application, * since this function also includes caching. + * + * Doesn't throw if it fails. */ export const useAccountMetadata = (scope: SearchScope, address: string): AccountMetadataInfo => { const isPontusX = scope.layer === Layer.pontusxtest || scope.layer === Layer.pontusxdev - const pontusXData = usePontusXAccountMetadata(address, { enabled: isPontusX }) - const oasisData = useOasisAccountMetadata(scope.network, scope.layer, getOasisAddress(address), { + const pontusXData = usePontusXAccountMetadata(address, { + enabled: isPontusX, useErrorBoundary: false, + }) + const oasisData = useOasisAccountMetadata(scope.network, scope.layer, getOasisAddress(address), { enabled: !isPontusX, + useErrorBoundary: false, }) return isPontusX ? pontusXData : oasisData } +/** Doesn't throw if it fails. */ export const useSearchForAccountsByName = ( scope: SearchScope, nameFragment = '', @@ -29,10 +35,12 @@ export const useSearchForAccountsByName = ( const isValidPontusXSearch = isPontusX && !!nameFragment const pontusXResults = useSearchForPontusXAccountsByName(scope.network, nameFragment, { enabled: isValidPontusXSearch, + useErrorBoundary: false, }) const isValidOasisSearch = !isPontusX && !!nameFragment const oasisResults = useSearchForOasisAccountsByName(scope.network, scope.layer, nameFragment, { enabled: isValidOasisSearch, + useErrorBoundary: false, }) return { isLoading: