mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
Skeletonize account UI while metadata is loading
While the kind-0 metadata query for logged-in accounts is in flight, we
were rendering the genUserName-derived animal name (and its first
letter as the avatar fallback) before falling back to the real display
name once the profile arrived. That made the AccountSwitcher trigger
flash a meaningless 'Brave Otter' / 'B' before settling on the real
identity.
Expose isLoading from useLoggedInAccounts and, while it is still true
and we have no metadata.name yet, render Skeletons in place of:
- the avatar fallback letter (in the AccountSwitcher trigger and the
other-accounts dropdown rows),
- the displayed name in the dropdown rows.
Once the query settles, behavior is unchanged: a real name renders if
present, otherwise the genUserName fallback fills in.
This commit is contained in:
2 files changed
+52
-21
No files matched your search
@@ -14,7 +14,7 @@ export function useLoggedInAccounts() {
|
||||
const { nostr } = useNostr();
|
||||
const { logins, setLogin, removeLogin } = useNostrLogin();
|
||||
|
||||
const { data: authors = [] } = useQuery({
|
||||
const { data: authors = [], isLoading } = useQuery({
|
||||
queryKey: ['nostr', 'logins', logins.map((l) => l.id).join(';')],
|
||||
queryFn: async () => {
|
||||
const events = await nostr.query(
|
||||
@@ -50,6 +50,7 @@ export function useLoggedInAccounts() {
|
||||
authors,
|
||||
currentUser,
|
||||
otherUsers,
|
||||
isLoading,
|
||||
setLogin,
|
||||
removeLogin,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user