From ed10771bf9a195d145e8b35070ce31830e7e3b57 Mon Sep 17 00:00:00 2001 From: christinaroise Date: Tue, 24 Sep 2024 11:44:26 +0200 Subject: [PATCH] fix after comments --- studio/components/LanguageSelector.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/studio/components/LanguageSelector.tsx b/studio/components/LanguageSelector.tsx index db1ba1a0d..ffdfc902d 100644 --- a/studio/components/LanguageSelector.tsx +++ b/studio/components/LanguageSelector.tsx @@ -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 @@ -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 + } />