fix: Fix language selection bug

This commit is contained in:
Jay Sitter 2023-06-23 17:21:10 -04:00
parent bf54d40433
commit ccf0a6dbaa
4 changed files with 18 additions and 10 deletions

View file

@ -260,8 +260,12 @@ export class MarkdownTextArea extends Component<
<LanguageSelect
iconVersion
allLanguages={this.props.allLanguages}
// Only set the selected language ID if it exists as an option
// in the dropdown; otherwise, set it to 0 (Undetermined)
selectedLanguageIds={
languageId ? Array.of(languageId) : undefined
languageId && this.props.siteLanguages.includes(languageId)
? Array.of(languageId)
: [0]
}
siteLanguages={this.props.siteLanguages}
onChange={this.handleLanguageChange}