: undefined
: undefined;
- const userInterfaceLangId = getUserInterfaceLangId({
- myUserInfo: UserService.Instance.myUserInfo,
- allLanguages: this.props.allLanguages,
- });
+ const userInterfaceLangId = !UserService.Instance.myUserInfo
+ ? 0
+ : getUserInterfaceLangId({
+ myUserInfo: UserService.Instance.myUserInfo,
+ allLanguages: this.props.allLanguages,
+ });
return (
<div
<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}
render() {
const url = this.state.form.url;
- const userInterfaceLangId = getUserInterfaceLangId({
- myUserInfo: UserService.Instance.myUserInfo,
- allLanguages: this.props.allLanguages,
- });
+ const userInterfaceLangId = !UserService.Instance.myUserInfo
+ ? 0
+ : getUserInterfaceLangId({
+ myUserInfo: UserService.Instance.myUserInfo,
+ allLanguages: this.props.allLanguages,
+ });
return (
<form className="post-form" onSubmit={linkEvent(this, handlePostSubmit)}>
return i18nLang.indexOf(lang.code) === 0;
});
- // Return the ID of that language object
+ // Return the ID of that language object, or "0" for Undetermined
return userLang.id || 0;
}