From 4d33e1c0d4fc1efe63e9c2da63d3a4a6b0777fae Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Mon, 22 Jul 2024 11:35:04 +0900 Subject: [PATCH] Revert "fix(helper/adapter): don't check `navigator` is `undefined` (#3171)" (#3173) This reverts commit a285c4b3b4bc7a9c162ec24669c9890b16f91f63. --- src/helper/adapter/index.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/helper/adapter/index.ts b/src/helper/adapter/index.ts index 95cbb6c4..01e73538 100644 --- a/src/helper/adapter/index.ts +++ b/src/helper/adapter/index.ts @@ -47,12 +47,8 @@ export const getRuntimeKey = (): Runtime => { const global = globalThis as any // check if the current runtime supports navigator.userAgent - let userAgentSupported = false - // In Cloudflare Pages, navigator is undefined in the production environment. - // Therefore, it only check navigator.userAgent. - try { - userAgentSupported = typeof navigator.userAgent === 'string' - } catch {} + const userAgentSupported = + typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' // if supported, check the user agent if (userAgentSupported) {