-
Notifications
You must be signed in to change notification settings - Fork 896
chore: reduce dashboard requests from seeded data #13034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We already inject all of this content in `index.html`. There was also a bug with displaying a loading indicator when the workspace proxies endpoint 404s.
1587c7f
to
fd977e2
Compare
site/src/api/queries/users.ts
Outdated
queryKey: meKey, | ||
initialData: initialUserData, | ||
queryFn: API.getAuthenticatedUser, | ||
}; | ||
// If we have initial user data, we don't want to fetch | ||
// the user again. We already have it! | ||
if (initialUserData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may could create some util in api/queries/utils
to reuse the cache configuration across queries:
export const cachedQuery = {
cacheTime: Infinity,
staleTime: Infinity,
refetchOnMount: false,
refetchOnReconnect: false,
refetchOnWindowFocus: false,
}
So it could be used like this:
const opts: UseQueryOptions<BuildInfoResponse> = {
...cachedQuery,
queryKey: buildInfoKey,
initialData: initialBuildInfoData,
queryFn: () => API.getBuildInfo(),
};
@BrunoQuaresma will do! |
We already inject all of this content in
index.html
.There was also a bug with displaying a loading indicator when the workspace proxies endpoint 404s.