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 9a36db4 commit 318a0b0Copy full SHA for 318a0b0
src/hooks/useUser.ts
@@ -58,15 +58,17 @@ export const useUser = ({
58
initialData,
59
}: { id?: number; initialData?: User } = {}): UserHookResponse => {
60
const router = useRouter();
61
- const isAuthPage = /^\/(login|setup|resetpassword)/.test(router.pathname);
+ const isAuthPage = /^\/(login|setup|resetpassword(?:\/|$))/.test(
62
+ router.pathname
63
+ );
64
65
const {
66
data,
67
error,
68
mutate: revalidate,
69
} = useSWR<User>(id ? `/api/v1/user/${id}` : `/api/v1/auth/me`, {
70
fallbackData: initialData,
- refreshInterval: 30000,
71
+ refreshInterval: !isAuthPage ? 30000 : 0,
72
revalidateOnFocus: !isAuthPage,
73
revalidateOnMount: !isAuthPage,
74
revalidateOnReconnect: !isAuthPage,
0 commit comments