Commit c7197bb4 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Do not send user operations API requests, if NEXT_PUBLIC_HAS_USER_OPS is not enabled (#1592)

* typo fix

* fix block views

* fix tx views

* Do not send user operations API requests, if NEXT_PUBLIC_HAS_USER_OPS is not enabled

---------
Co-authored-by: default avatarisstuev <natix.naf@gmail.com>
parent 86a888e4
...@@ -67,7 +67,7 @@ const AddressPageContent = () => { ...@@ -67,7 +67,7 @@ const AddressPageContent = () => {
const userOpsAccountQuery = useApiQuery('user_ops_account', { const userOpsAccountQuery = useApiQuery('user_ops_account', {
pathParams: { hash }, pathParams: { hash },
queryOptions: { queryOptions: {
enabled: Boolean(hash), enabled: Boolean(hash) && config.features.userOps.isEnabled,
placeholderData: USER_OPS_ACCOUNT, placeholderData: USER_OPS_ACCOUNT,
}, },
}); });
...@@ -160,16 +160,18 @@ const AddressPageContent = () => { ...@@ -160,16 +160,18 @@ const AddressPageContent = () => {
].filter(Boolean); ].filter(Boolean);
}, [ addressQuery.data, contractTabs, addressTabsCountersQuery.data, userOpsAccountQuery.data ]); }, [ addressQuery.data, contractTabs, addressTabsCountersQuery.data, userOpsAccountQuery.data ]);
const isLoading = addressQuery.isPlaceholderData || (config.features.userOps.isEnabled && userOpsAccountQuery.isPlaceholderData);
const tags = ( const tags = (
<EntityTags <EntityTags
data={ addressQuery.data } data={ addressQuery.data }
isLoading={ addressQuery.isPlaceholderData } isLoading={ isLoading }
tagsBefore={ [ tagsBefore={ [
!addressQuery.data?.is_contract ? { label: 'eoa', display_name: 'EOA' } : undefined, !addressQuery.data?.is_contract ? { label: 'eoa', display_name: 'EOA' } : undefined,
addressQuery.data?.implementation_address ? { label: 'proxy', display_name: 'Proxy' } : undefined, addressQuery.data?.implementation_address ? { label: 'proxy', display_name: 'Proxy' } : undefined,
addressQuery.data?.token ? { label: 'token', display_name: 'Token' } : undefined, addressQuery.data?.token ? { label: 'token', display_name: 'Token' } : undefined,
isSafeAddress ? { label: 'safe', display_name: 'Multisig: Safe' } : undefined, isSafeAddress ? { label: 'safe', display_name: 'Multisig: Safe' } : undefined,
userOpsAccountQuery.data ? { label: 'user_ops_acc', display_name: 'Smart contract wallet' } : undefined, config.features.userOps.isEnabled && userOpsAccountQuery.data ? { label: 'user_ops_acc', display_name: 'Smart contract wallet' } : undefined,
] } ] }
/> />
); );
...@@ -189,8 +191,6 @@ const AddressPageContent = () => { ...@@ -189,8 +191,6 @@ const AddressPageContent = () => {
}; };
}, [ appProps.referrer ]); }, [ appProps.referrer ]);
const isLoading = addressQuery.isPlaceholderData;
const titleSecondRow = ( const titleSecondRow = (
<Flex alignItems="center" w="100%" columnGap={ 2 } rowGap={ 2 } flexWrap={{ base: 'wrap', lg: 'nowrap' }}> <Flex alignItems="center" w="100%" columnGap={ 2 } rowGap={ 2 } flexWrap={{ base: 'wrap', lg: 'nowrap' }}>
{ addressQuery.data?.ens_domain_name && ( { addressQuery.data?.ens_domain_name && (
...@@ -241,7 +241,7 @@ const AddressPageContent = () => { ...@@ -241,7 +241,7 @@ const AddressPageContent = () => {
<AddressDetails addressQuery={ addressQuery } scrollRef={ tabsScrollRef }/> <AddressDetails addressQuery={ addressQuery } scrollRef={ tabsScrollRef }/>
{ /* should stay before tabs to scroll up with pagination */ } { /* should stay before tabs to scroll up with pagination */ }
<Box ref={ tabsScrollRef }></Box> <Box ref={ tabsScrollRef }></Box>
{ (addressQuery.isPlaceholderData || addressTabsCountersQuery.isPlaceholderData || userOpsAccountQuery.isPlaceholderData) ? { (isLoading || addressTabsCountersQuery.isPlaceholderData) ?
<TabsSkeleton tabs={ tabs }/> : <TabsSkeleton tabs={ tabs }/> :
content content
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment