Change user update indicator (#450)

This commit is contained in:
Luke Vella 2023-01-30 18:47:26 +00:00 committed by GitHub
parent 0628ce5971
commit e21574b032
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -12,6 +12,7 @@ export const UserContext =
React.createContext<{
user: UserSession & { shortName: string };
refresh: () => void;
isUpdating: boolean;
logout: () => void;
ownsObject: (obj: { userId: string | null }) => boolean;
} | null>(null);
@ -82,9 +83,7 @@ export const UserProvider = (props: { children?: React.ReactNode }) => {
});
});
const shortName = isFetching
? t("loading")
: user
const shortName = user
? user.isGuest === false
? user.name
: user.id.substring(0, 10)
@ -97,6 +96,7 @@ export const UserProvider = (props: { children?: React.ReactNode }) => {
return (
<UserContext.Provider
value={{
isUpdating: isFetching,
user: { ...user, shortName },
refresh: () => {
return queryClient.whoami.invalidate();