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 8d47532 commit ca0a9dbCopy full SHA for ca0a9db
1 file changed
src/contexts/LoginModalContext.tsx
@@ -10,9 +10,17 @@ interface LoginModalContextValue {
10
closeLoginModal: () => void
11
}
12
13
-const LoginModalContext = React.createContext<LoginModalContextValue | null>(
14
- null,
15
-)
+declare global {
+ var __tanstackLoginModalContext:
+ | React.Context<LoginModalContextValue | null>
16
+ | undefined
17
+}
18
+
19
+const LoginModalContext =
20
+ import.meta.env.DEV && typeof window !== 'undefined'
21
+ ? (globalThis.__tanstackLoginModalContext ??=
22
+ React.createContext<LoginModalContextValue | null>(null))
23
+ : React.createContext<LoginModalContextValue | null>(null)
24
25
export function useLoginModal() {
26
const context = React.useContext(LoginModalContext)
0 commit comments