diff --git a/packages/next-auth/src/react.tsx b/packages/next-auth/src/react.tsx index a900155c68..4110e2bf81 100644 --- a/packages/next-auth/src/react.tsx +++ b/packages/next-auth/src/react.tsx @@ -67,21 +67,27 @@ export const __NEXTAUTH: AuthClientConfig = { _getSession: () => {}, } +// https://github.com/nextauthjs/next-auth/pull/10762 let broadcastChannel: BroadcastChannel | null = null function getNewBroadcastChannel() { - return new BroadcastChannel("next-auth") -} - -function broadcast() { if (typeof BroadcastChannel === "undefined") { return { postMessage: () => {}, addEventListener: () => {}, removeEventListener: () => {}, - } + name: "next-auth", + onmessage: null, + onmessageerror: null, + close: () => {}, + dispatchEvent: () => false, + } satisfies BroadcastChannel } + return new BroadcastChannel("next-auth") +} + +function broadcast() { if (broadcastChannel === null) { broadcastChannel = getNewBroadcastChannel() } @@ -180,8 +186,8 @@ export async function getSession(params?: GetSessionParams) { params ) if (params?.broadcast ?? true) { - const broadcastChannel = getNewBroadcastChannel() - broadcastChannel.postMessage({ + // https://github.com/nextauthjs/next-auth/pull/11470 + getNewBroadcastChannel().postMessage({ event: "session", data: { trigger: "getSession" }, }) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy