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.
BroadcastChannel
1 parent ba1304c commit fd4cc7dCopy full SHA for fd4cc7d
packages/next-auth/src/react.tsx
@@ -69,15 +69,22 @@ export const __NEXTAUTH: AuthClientConfig = {
69
_getSession: () => {},
70
}
71
72
+let broadcastChannel: BroadcastChannel | null = null
73
+
74
function broadcast() {
- if (typeof BroadcastChannel !== "undefined") {
- return new BroadcastChannel("next-auth")
75
+ if (typeof BroadcastChannel === "undefined") {
76
+ return {
77
+ postMessage: () => {},
78
+ addEventListener: () => {},
79
+ removeEventListener: () => {},
80
+ }
81
- return {
- postMessage: () => {},
- addEventListener: () => {},
- removeEventListener: () => {},
82
83
+ if (broadcastChannel === null) {
84
+ broadcastChannel = new BroadcastChannel("next-auth")
85
86
87
+ return broadcastChannel
88
89
90
// TODO:
0 commit comments