Skip to content

Commit c372032

Browse files
committed
attempt to use arm as default for mac
1 parent 9fbb9f6 commit c372032

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/site/hooks/react-client/__tests__/useDetectOS.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('useDetectOS', () => {
7272
assert.deepEqual(result.current, {
7373
os: 'MAC',
7474
bitness: '32',
75-
architecture: 'x86',
75+
architecture: 'arm64',
7676
});
7777
});
7878
});

apps/site/hooks/react-client/useDetectOS.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ const useDetectOS = () => {
2828
navigator.userAgent
2929
);
3030

31+
const os = detectOS();
32+
3133
// We immediately set the OS to LOADING, and then we update it with the detected OS.
3234
// This is due to that initial render set within the state will indicate a mismatch from
3335
// the server-side rendering versus what the initial state is from the client-side
34-
setUserOSState(current => ({ ...current, os: detectOS() }));
36+
setUserOSState(current => ({ ...current, os }));
3537

3638
// We attempt to get the high entropy values from the Browser and set the User OS State
3739
// based from the values we get from the Browser, if it fails we fallback to the User Agent
@@ -41,7 +43,8 @@ const useDetectOS = () => {
4143
// If there is no getHighEntropyValues API on the Browser or it failed to resolve
4244
// we attempt to fallback to what the User Agent indicates
4345
bitness = uaIndicates64 ? '64' : '32',
44-
architecture = 'x86',
46+
// we assume that MacOS has moved to arm64 by default now
47+
architecture = os === 'MAC' ? 'arm64' : 'x86',
4548
}) => {
4649
setUserOSState(current => ({
4750
...current,

0 commit comments

Comments
 (0)