Skip to content

Commit 3b02d21

Browse files
committed
Fix infinite loop in useEffect
1 parent 1a490df commit 3b02d21

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

site/contexts/UserContext.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export const useUser = (redirectOnError = false): UserContext => {
3939
},
4040
})
4141
}
42-
}, [asPath, push, redirectOnError, requestError])
42+
// Disabling exhaustive deps here because it can cause an
43+
// infinite useEffect loop. Should (hopefully) go away
44+
// when we switch to an alternate routing strategy.
45+
}, [redirectOnError, requestError]) // eslint-disable-line react-hooks/exhaustive-deps
4346

4447
return ctx
4548
}

0 commit comments

Comments
 (0)