We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
balazsorban44
ThangHuuVu
Learn more about funding links in repositories.
Report abuse
1 parent 87f4786 commit f770b90Copy full SHA for f770b90
packages/next-auth/src/client/_utils.ts
@@ -94,10 +94,18 @@ export function BroadcastChannel(name = "nextauth.message") {
94
/** Notify other tabs/windows. */
95
post(message: Record<string, unknown>) {
96
if (typeof window === "undefined") return
97
- localStorage.setItem(
98
- name,
99
- JSON.stringify({ ...message, timestamp: now() })
100
- )
+ try {
+ localStorage.setItem(
+ name,
+ JSON.stringify({ ...message, timestamp: now() })
101
+ )
102
+ } catch {
103
+ /**
104
+ * The localStorage API isn't always available.
105
+ * It won't work in private mode prior to Safari 11 for example.
106
+ * Notifications are simply dropped if an error is encountered.
107
+ */
108
+ }
109
},
110
}
111
0 commit comments