File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
apps/site/hooks/react-client Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff 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 } ) ;
Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments