Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window use on server for docs #3714

Merged
merged 8 commits into from
Dec 5, 2022
3 changes: 2 additions & 1 deletion website/src/theme/Tabs/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, cloneElement, isValidElement } from 'react';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import clsx from 'clsx';
import useIsBrowser from '@docusaurus/useIsBrowser';
import { duplicates } from '@docusaurus/theme-common';
Expand Down Expand Up @@ -28,7 +29,7 @@ function isTabItem(comp) {
}

function getOSName() {
const userAgent = navigator.userAgent;
const userAgent = ExecutionEnvironment.canUseDOM ? navigator.userAgent : "";
if (userAgent.indexOf('Windows') > -1) {
return 'Windows';
} else if (userAgent.indexOf('Mac') > -1) {
Expand Down