Skip to content

Commit b14d522

Browse files
committed
fix: update cloud mode handling in HeaderAction component
- Adjusted the useCloudMode hook in HeaderAction to provide a default repo value, ensuring consistent behavior when pathConfig is not defined. - Improved robustness of language selection logic in the LangSwitch component by handling potential undefined values for pathConfig.
1 parent 2782429 commit b14d522

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/Layout/HeaderAction.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import TranslateIcon from "media/icons/globe-02.svg";
1717

1818
import Search from "components/Search";
1919

20-
import { Locale, BuildType, PathConfig } from "shared/interface";
20+
import { Locale, BuildType, PathConfig, Repo } from "shared/interface";
2121
import { ActionButton } from "components/Card/FeedbackSection/components";
2222
import { Link } from "gatsby";
2323
import { useIsAutoTranslation } from "shared/useIsAutoTranslation";
@@ -134,7 +134,7 @@ const LangSwitch = (props: {
134134

135135
const theme = useTheme();
136136
const { language, changeLanguage } = useI18next();
137-
const { isClassic } = useCloudMode(pathConfig!.repo);
137+
const { isClassic } = useCloudMode(pathConfig?.repo || Repo.tidb);
138138

139139
const open = Boolean(anchorEl);
140140
const handleClick = (event: React.MouseEvent<HTMLElement>) => {

0 commit comments

Comments
 (0)