Skip to content

Commit f8222de

Browse files
authored
fix(core): check for SSR env before doing a firefox nav check (#224)
1 parent cf88874 commit f8222de

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/sixty-times-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@formwerk/core': patch
3+
---
4+
5+
fix(core): OTP fields crashing in SSR environments

packages/core/src/utils/platform.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { isSSR } from '../utils/common';
22

33
export function isMac() {
4-
const macRE = /^Mac/i;
54
if (isSSR) {
65
return false;
76
}
87

8+
const macRE = /^Mac/i;
99
let platform = navigator.platform;
1010
if ('userAgentData' in navigator) {
1111
platform = (navigator.userAgentData as { platform: string }).platform;
@@ -15,5 +15,9 @@ export function isMac() {
1515
}
1616

1717
export function isFirefox() {
18+
if (isSSR) {
19+
return false;
20+
}
21+
1822
return /Firefox/i.test(navigator.userAgent);
1923
}

0 commit comments

Comments
 (0)