From 22814d857185f9cca08f3d8a0bd9c97b6a1b40d5 Mon Sep 17 00:00:00 2001 From: christinaroise Date: Mon, 23 Sep 2024 19:09:25 +0200 Subject: [PATCH] remove debug --- studio/components/LanguageSelector.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/studio/components/LanguageSelector.tsx b/studio/components/LanguageSelector.tsx index 8f80614d2..55562cafb 100644 --- a/studio/components/LanguageSelector.tsx +++ b/studio/components/LanguageSelector.tsx @@ -29,7 +29,6 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => { // Get the currently set default language const currentDefaultLanguage = value.find((lang) => lang.default)?.id || null; - console.log(currentDefaultLanguage); const handleLanguageSelection = (lang: Language) => { const isSelected = value.some((item) => item.id === lang.id); @@ -46,7 +45,7 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => { const newDefaultLanguage = getNewDefaultLanguage( updatedValue, currentDefaultLanguage, - lang, + lang ); const finalValue = updatedValue.map((item) => ({ @@ -131,17 +130,17 @@ const LanguageSelector = ({ value = [], onChange }: LanguageSelectorProps) => { const getNewDefaultLanguage = ( updatedLanguages: Language[], currentDefault: string | null, - deselectedLang: Language, + deselectedLang: Language ): string | null => { if (updatedLanguages.length === 1) { - return updatedLanguages[0].id; // Only one language left + return updatedLanguages[0].id; } if (currentDefault === deselectedLang.id) { // Find a new default language if the current default is deselected return ( supportedLanguages.find((lang) => - updatedLanguages.some((item) => item.id === lang.id), + updatedLanguages.some((item) => item.id === lang.id) )?.id || null ); }