Skip to content

Commit

Permalink
Fall back to languageSet if no languageTabs provided (#871)
Browse files Browse the repository at this point in the history
* fall back to languageSet is no languageTabs provided

* switch to nullish operator
  • Loading branch information
sserrata authored Jul 3, 2024
1 parent d03859d commit ade18a4
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ function CodeSnippets({ postman, codeSamples }: Props) {

// User-defined languages array
// Can override languageSet, change order of langs, override options and variants
const userDefinedLanguageSet = siteConfig?.themeConfig?.languageTabs as
| Language[]
| undefined;
const userDefinedLanguageSet =
(siteConfig?.themeConfig?.languageTabs as Language[] | undefined) ??
languageSet;

// Filter languageSet by user-defined langs
const filteredLanguageSet = languageSet.filter((ls) => {
Expand All @@ -189,8 +189,6 @@ function CodeSnippets({ postman, codeSamples }: Props) {
codeSamples
);

console.log("merged", mergedLangs);

// Read defaultLang from localStorage
const defaultLang: Language[] = mergedLangs.filter(
(lang) =>
Expand Down

0 comments on commit ade18a4

Please sign in to comment.