Skip to content

Commit be5668e

Browse files
committed
Swallow any errors when opportunistically looking up token names
Any time we display an address, we want to check out if it has a token name. However, if it does not, we get a 404 error, and hence, a big ugly exception on the console. This change flags this request so that any error will be swallowed.
1 parent b63ee09 commit be5668e

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

.changelog/2163.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Swallow any errors when opportunistically looking up token names

src/app/hooks/useAccountMetadata.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const useAccountMetadata = (scope: SearchScope, address: string): Account
3636
// The type cast is OK because whenever we are on consensus, we will set enabled to false
3737
enabled: !registryData?.metadata && scope.layer !== 'consensus',
3838
useCaching: true,
39+
swallowError: true,
3940
})
4041
const tokenData: AccountMetadataInfo = {
4142
metadata: token ? { address: token.contract_addr, name: token.name, source: 'SelfProfessed' } : undefined,

src/app/pages/TokenDashboardPage/hook.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ interface UseTokenInfoParams {
2020
/** Defaults to true */
2121
enabled?: boolean
2222
useCaching?: boolean
23+
swallowError?: boolean
2324
}
2425

2526
export const useTokenInfo = (scope: RuntimeScope, address: string, params: UseTokenInfoParams = {}) => {
2627
const { network, layer } = scope
27-
const { enabled, useCaching } = params
28+
const { enabled, useCaching, swallowError = false } = params
2829
const query = useGetRuntimeEvmTokensAddress(network, layer, address, {
2930
query: {
3031
enabled,
3132
staleTime: useCaching ? 3600000 : undefined,
3233
},
34+
request: swallowError ? ({ swallowError } as any) : undefined,
3335
})
3436
const token = query.data?.data
3537
const { isLoading, isError, isFetched } = query

0 commit comments

Comments
 (0)