Skip to content

Commit

Permalink
Do not send user operations API requests, if NEXT_PUBLIC_HAS_USER_OPS…
Browse files Browse the repository at this point in the history
… is not enabled
  • Loading branch information
tom2drum committed Feb 9, 2024
1 parent 9068d41 commit c15859e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ui/pages/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const AddressPageContent = () => {
const userOpsAccountQuery = useApiQuery('user_ops_account', {
pathParams: { hash },
queryOptions: {
enabled: Boolean(hash),
enabled: Boolean(hash) && config.features.userOps.isEnabled,
placeholderData: USER_OPS_ACCOUNT,
},
});
Expand Down Expand Up @@ -160,16 +160,18 @@ const AddressPageContent = () => {
].filter(Boolean);
}, [ addressQuery.data, contractTabs, addressTabsCountersQuery.data, userOpsAccountQuery.data ]);

const isLoading = addressQuery.isPlaceholderData || (config.features.userOps.isEnabled && userOpsAccountQuery.isPlaceholderData);

const tags = (
<EntityTags
data={ addressQuery.data }
isLoading={ addressQuery.isPlaceholderData }
isLoading={ isLoading }
tagsBefore={ [
!addressQuery.data?.is_contract ? { label: 'eoa', display_name: 'EOA' } : undefined,
addressQuery.data?.implementation_address ? { label: 'proxy', display_name: 'Proxy' } : undefined,
addressQuery.data?.token ? { label: 'token', display_name: 'Token' } : 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,
] }
/>
);
Expand All @@ -189,8 +191,6 @@ const AddressPageContent = () => {
};
}, [ appProps.referrer ]);

const isLoading = addressQuery.isPlaceholderData;

const titleSecondRow = (
<Flex alignItems="center" w="100%" columnGap={ 2 } rowGap={ 2 } flexWrap={{ base: 'wrap', lg: 'nowrap' }}>
{ addressQuery.data?.ens_domain_name && (
Expand Down Expand Up @@ -241,7 +241,7 @@ const AddressPageContent = () => {
<AddressDetails addressQuery={ addressQuery } scrollRef={ tabsScrollRef }/>
{ /* should stay before tabs to scroll up with pagination */ }
<Box ref={ tabsScrollRef }></Box>
{ (addressQuery.isPlaceholderData || addressTabsCountersQuery.isPlaceholderData || userOpsAccountQuery.isPlaceholderData) ?
{ (isLoading || addressTabsCountersQuery.isPlaceholderData) ?
<TabsSkeleton tabs={ tabs }/> :
content
}
Expand Down

0 comments on commit c15859e

Please sign in to comment.