Skip to content

Commit

Permalink
fix after comments
Browse files Browse the repository at this point in the history
  • Loading branch information
christinaroise committed Sep 24, 2024
1 parent 237b8b6 commit ed10771
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions studio/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ const LanguageSelector = ({

const handleLanguageSelection = (lang: Language) => {
const isSelected = value.some((item) => item.id === lang.id);
// Prevent deselecting the last remaining language
if (isSelected && value.length === 1) {
return; // Exit early if there's only one language selected
}

const updatedValue = isSelected
? value.filter((item) => item.id !== lang.id) // Deselect language
: [...value, { ...lang, default: false }]; // Select language
Expand Down Expand Up @@ -88,6 +83,9 @@ const LanguageSelector = ({
id={lang.id}
checked={value.some((item) => item.id === lang.id)}
readOnly
disabled={
value?.length <= 1 && currentDefaultLanguage === lang.id
}
/>
<Box flex={1} paddingLeft={3}>
<Text>
Expand Down

0 comments on commit ed10771

Please sign in to comment.