Skip to content

Commit

Permalink
cleanup redundant boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
christinaroise committed Sep 25, 2024
1 parent f51692c commit 2fd1d6b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions studio/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => {
// Find current default language
const currentDefaultLanguage = value.find((lang) => lang.default)?.id || null;

const handleLanguageSelection = (lang: Language) => {
const isSelected = value.some((item) => item.id === lang.id);

const handleLanguageSelection = (lang: Language, isSelected: boolean) => {
let updatedValue;

if (isSelected) {
Expand Down Expand Up @@ -82,7 +80,7 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => {
id={lang.id}
checked={isSelected}
onClick={() => {
handleLanguageSelection(lang);
handleLanguageSelection(lang, isSelected);
}}
disabled={isSelected && value.length === 1}
/>
Expand Down

0 comments on commit 2fd1d6b

Please sign in to comment.