Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: do not warn about navigator lock when not used (#18287)

Han Qiao609d5283b7a9
diff --git a/packages/common/gotrue.ts b/packages/common/gotrue.ts
index 11507565ad1..e449a70ea4b 100644
--- a/packages/common/gotrue.ts
+++ b/packages/common/gotrue.ts
@@ -17,13 +17,13 @@ const persistedDebug =
process.env.NEXT_PUBLIC_IS_PLATFORM === 'true' &&
globalThis?.localStorage?.getItem(AUTH_DEBUG_PERSISTED_KEY) === 'true'
-const navigatorLockEnabled = !!(
+const shouldEnableNavigatorLock =
process.env.NEXT_PUBLIC_IS_PLATFORM === 'true' &&
- !(globalThis?.localStorage?.getItem(AUTH_NAVIGATOR_LOCK_DISABLED_KEY) === 'true') &&
- globalThis?.navigator?.locks
-)
+ !(globalThis?.localStorage?.getItem(AUTH_NAVIGATOR_LOCK_DISABLED_KEY) === 'true')
-if (!globalThis?.navigator?.locks) {
+const navigatorLockEnabled = !!(shouldEnableNavigatorLock && globalThis?.navigator?.locks)
+
+if (shouldEnableNavigatorLock && !globalThis?.navigator?.locks) {
console.warn('This browser does not support the Navigator Locks API. Please update it.')
}