Skip to content

Commit

Permalink
Revert "fix(helper/adapter): don't check navigator is undefined (#…
Browse files Browse the repository at this point in the history
…3171)" (#3173)

This reverts commit a285c4b.
  • Loading branch information
yusukebe authored Jul 22, 2024
1 parent bb14b1e commit 4d33e1c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/helper/adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4d33e1c

Please sign in to comment.