Skip to content

Commit 9f459d9

Browse files
committed
use initialQuery, add back meta tag for initial load of users
1 parent 52b9b72 commit 9f459d9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

site/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<meta property="og:type" content="website" />
1818
<meta property="csrf-token" content="{{ .CSRF.Token }}" />
1919
<meta property="build-info" content="{{ .BuildInfo }}" />
20+
<meta property="user" content="{{ .User }}" />
2021
<meta property="entitlements" content="{{ .Entitlements }}" />
2122
<meta property="appearance" content="{{ .Appearance }}" />
2223
<meta property="experiments" content="{{ .Experiments }}" />

site/src/api/queries/users.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import {
66
UpdateUserPasswordRequest,
77
UpdateUserProfileRequest,
88
UsersRequest,
9+
User,
910
} from "api/typesGenerated";
1011
import { getAuthorizationKey } from "./authCheck";
12+
import { getMetadataAsJSON } from "utils/metadata";
1113

1214
export const users = (req: UsersRequest): UseQueryOptions<GetUsersResponse> => {
1315
return {
@@ -90,7 +92,8 @@ export const authMethods = () => {
9092
export const me = () => {
9193
return {
9294
queryKey: ["me"],
93-
queryFn: async () => API.getAuthenticatedUser(),
95+
initialData: getMetadataAsJSON<User>("user"),
96+
queryFn: API.getAuthenticatedUser,
9497
};
9598
};
9699

0 commit comments

Comments
 (0)