File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ export const __NEXTAUTH: AuthClientConfig = {
71
71
72
72
let broadcastChannel : BroadcastChannel | null = null
73
73
74
+ function getNewBroadcastChannel ( ) {
75
+ return new BroadcastChannel ( "next-auth" )
76
+ )
77
+
74
78
function broadcast ( ) {
75
79
if ( typeof BroadcastChannel === "undefined" ) {
76
80
return {
@@ -81,7 +85,7 @@ function broadcast() {
81
85
}
82
86
83
87
if ( broadcastChannel === null ) {
84
- broadcastChannel = new BroadcastChannel ( "next-auth" )
88
+ broadcastChannel = getNewBroadcastChannel ( )
85
89
}
86
90
87
91
return broadcastChannel
@@ -178,7 +182,8 @@ export async function getSession(params?: GetSessionParams) {
178
182
params
179
183
)
180
184
if ( params ?. broadcast ?? true ) {
181
- broadcast ( ) . postMessage ( {
185
+ const broadcastChannel = getNewBroadcastChannel ( )
186
+ broadcastChannel . postMessage ( {
182
187
event : "session" ,
183
188
data : { trigger : "getSession" } ,
184
189
} )
You can’t perform that action at this time.
0 commit comments