Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
c2f99e9e
Commit
c2f99e9e
authored
Apr 16, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix loading state of profile button
parent
e856a9be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
useAccountWithDomain.ts
lib/web3/useAccountWithDomain.ts
+3
-3
UserProfileButton.tsx
ui/snippets/user/profile/UserProfileButton.tsx
+5
-5
No files found.
lib/web3/useAccountWithDomain.ts
View file @
c2f99e9e
...
...
@@ -6,7 +6,7 @@ import useApiQuery from 'lib/api/useApiQuery';
import
useAccount
from
'
./useAccount
'
;
export
default
function
useAccountWithDomain
(
isEnabled
:
boolean
)
{
const
{
address
}
=
useAccount
();
const
{
address
,
isConnecting
}
=
useAccount
();
const
isQueryEnabled
=
config
.
features
.
nameService
.
isEnabled
&&
Boolean
(
address
)
&&
Boolean
(
isEnabled
);
...
...
@@ -25,7 +25,7 @@ export default function useAccountWithDomain(isEnabled: boolean) {
return
{
address
:
isEnabled
?
address
:
undefined
,
domain
:
domainQuery
.
data
?.
domain
?.
name
,
isLoading
:
isQueryEnabled
&&
domainQuery
.
isLoad
ing
,
isLoading
:
(
isQueryEnabled
&&
domainQuery
.
isLoading
)
||
isConnect
ing
,
};
},
[
address
,
domainQuery
.
data
?.
domain
?.
name
,
domainQuery
.
isLoading
,
isEnabled
,
isQueryEnabled
]);
},
[
address
,
domainQuery
.
data
?.
domain
?.
name
,
domainQuery
.
isLoading
,
isEnabled
,
isQueryEnabled
,
isConnecting
]);
}
ui/snippets/user/profile/UserProfileButton.tsx
View file @
c2f99e9e
...
...
@@ -42,8 +42,11 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending, ..
e
.
preventDefault
();
},
[]);
const
isButtonLoading
=
isPending
||
!
isFetched
||
web3AccountWithDomain
.
isLoading
;
const
dataExists
=
!
isButtonLoading
&&
(
Boolean
(
data
)
||
Boolean
(
web3AccountWithDomain
.
address
));
const
content
=
(()
=>
{
if
(
web3AccountWithDomain
.
address
)
{
if
(
web3AccountWithDomain
.
address
&&
!
isButtonLoading
)
{
return
(
<
HStack
gap=
{
2
}
>
<
UserIdenticon
address=
{
web3AccountWithDomain
.
address
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
/>
...
...
@@ -54,7 +57,7 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending, ..
);
}
if
(
!
data
)
{
if
(
!
data
||
isButtonLoading
)
{
return
'
Log in
'
;
}
...
...
@@ -66,9 +69,6 @@ const UserProfileButton = ({ profileQuery, size, variant, onClick, isPending, ..
);
})();
const
isButtonLoading
=
isPending
||
!
isFetched
;
const
dataExists
=
!
isButtonLoading
&&
(
Boolean
(
data
)
||
Boolean
(
web3AccountWithDomain
.
address
));
return
(
<
Tooltip
content=
{
<
span
>
Sign in to My Account to add tags,
<
br
/>
create watchlists, access API keys and more
</
span
>
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment