From 2fd1d6bc282a453e0b707ccaa5ca7499d83cb31a Mon Sep 17 00:00:00 2001 From: christinaroise Date: Wed, 25 Sep 2024 08:51:39 +0200 Subject: [PATCH] cleanup redundant boolean --- studio/components/LanguageSelector.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/studio/components/LanguageSelector.tsx b/studio/components/LanguageSelector.tsx index 5020fbef5..485ac4d5a 100644 --- a/studio/components/LanguageSelector.tsx +++ b/studio/components/LanguageSelector.tsx @@ -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) { @@ -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} />