Skip to content

Commit

Permalink
fix: Cleanup global __NEXTAUTH state after unmount (#4383)
Browse files Browse the repository at this point in the history
  • Loading branch information
skirsten committed Apr 14, 2022
1 parent 82159d3 commit 58d06ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/next-auth/src/react/index.tsx
Expand Up @@ -359,6 +359,12 @@ export function SessionProvider(props: SessionProviderProps) {
}

__NEXTAUTH._getSession()

return () => {
__NEXTAUTH._lastSync = 0
__NEXTAUTH._session = undefined
__NEXTAUTH._getSession = () => {}
}
}, [])

React.useEffect(() => {
Expand Down

0 comments on commit 58d06ed

Please sign in to comment.