We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd5fc96 commit 6ea6de7Copy full SHA for 6ea6de7
apps/web/src/client/_components/hooks/useUser.ts
@@ -1,12 +1,16 @@
1
import { fetcher } from '@/features/swr/fetcher';
2
import type { getUserResponseSchema } from '@read-stack/openapi';
3
-import useSWR from 'swr';
+import useImmutableSWR from 'swr/immutable';
4
import type { z } from 'zod';
5
6
type GetMeResponse = z.infer<typeof getUserResponseSchema>;
7
8
export const useUser = () => {
9
- const { data, error } = useSWR<GetMeResponse>('/api/v1/users/me', fetcher);
+ const { data, error } = useImmutableSWR<GetMeResponse>(
10
+ '/api/v1/users/me',
11
+ fetcher,
12
+ {},
13
+ );
14
15
return { user: data?.user, error };
16
};
0 commit comments