From 471db402852e2a54ddf1bf2b3890e0f4549df4c5 Mon Sep 17 00:00:00 2001 From: Kartik Virendra Rajput <88619994+kartikvirendrar@users.noreply.github.com> Date: Mon, 6 May 2024 12:10:11 +0530 Subject: [PATCH 1/3] make selected languages unique --- src/ui/pages/container/Label-Studio/LSF.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/pages/container/Label-Studio/LSF.jsx b/src/ui/pages/container/Label-Studio/LSF.jsx index 000d3457..779f31ae 100644 --- a/src/ui/pages/container/Label-Studio/LSF.jsx +++ b/src/ui/pages/container/Label-Studio/LSF.jsx @@ -990,14 +990,18 @@ const LabelStudioWrapper = ({ if(taskData){ if(Array.isArray(taskData?.data?.language)){ taskData?.data?.language?.map((lang)=>{ - selectedLanguages.current?.push(lang); + if (!selectedLanguages.current.includes(lang)) { + selectedLanguages.current.push(lang); + } const newLanguages = new Set([...selectedL, ...taskData?.data?.language]); setSelectedL(Array.from(newLanguages)); }); } if(typeof taskData?.data?.language === 'string' && taskData?.data?.ocr_domain !== ""){ setSelectedL([taskData?.data?.language]); - selectedLanguages.current?.push(taskData?.data?.language); + if (!selectedLanguages.current.includes(taskData?.data?.language)) { + selectedLanguages.current.push(taskData?.data?.language); + } } if(typeof taskData?.data?.ocr_domain === 'string' && taskData?.data?.ocr_domain !== ""){ ocrDomain.current = taskData?.data?.ocr_domain; From 4a23f55219913bf29f9bd49c7c0cc297523c9dfe Mon Sep 17 00:00:00 2001 From: Kartik Virendra Rajput <88619994+kartikvirendrar@users.noreply.github.com> Date: Mon, 6 May 2024 12:10:39 +0530 Subject: [PATCH 2/3] make selected languages unique --- src/ui/pages/container/Label-Studio/ReviewLSF.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/pages/container/Label-Studio/ReviewLSF.jsx b/src/ui/pages/container/Label-Studio/ReviewLSF.jsx index 5562ef68..e398a124 100644 --- a/src/ui/pages/container/Label-Studio/ReviewLSF.jsx +++ b/src/ui/pages/container/Label-Studio/ReviewLSF.jsx @@ -1198,14 +1198,18 @@ useEffect(() => { if(taskData){ if(Array.isArray(taskData?.data?.language)){ taskData?.data?.language?.map((lang)=>{ - selectedLanguages.current?.push(lang); + if (!selectedLanguages.current.includes(lang)) { + selectedLanguages.current.push(lang); + } const newLanguages = new Set([...selectedL, ...taskData?.data?.language]); setSelectedL(Array.from(newLanguages)); }); } if(typeof taskData?.data?.language === 'string' && taskData?.data?.ocr_domain !== ""){ setSelectedL([taskData?.data?.language]); - selectedLanguages.current?.push(taskData?.data?.language); + if (!selectedLanguages.current.includes(taskData?.data?.language)) { + selectedLanguages.current.push(taskData?.data?.language); + } } if(typeof taskData?.data?.ocr_domain === 'string' && taskData?.data?.ocr_domain !== ""){ ocrDomain.current = taskData?.data?.ocr_domain; From dc1fc2424f11d2e57fbca1c2156a223f5d6511b4 Mon Sep 17 00:00:00 2001 From: Kartik Virendra Rajput <88619994+kartikvirendrar@users.noreply.github.com> Date: Mon, 6 May 2024 12:11:08 +0530 Subject: [PATCH 3/3] make selected languages unique --- src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx b/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx index 29cdb96d..9acd9966 100644 --- a/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx +++ b/src/ui/pages/container/Label-Studio/SuperCheckerLSF.jsx @@ -910,14 +910,18 @@ useEffect(() => { if(taskData){ if(Array.isArray(taskData?.data?.language)){ taskData?.data?.language?.map((lang)=>{ - selectedLanguages.current?.push(lang); + if (!selectedLanguages.current.includes(lang)) { + selectedLanguages.current.push(lang); + } const newLanguages = new Set([...selectedL, ...taskData?.data?.language]); setSelectedL(Array.from(newLanguages)); }); } if(typeof taskData?.data?.language === 'string' && taskData?.data?.ocr_domain !== ""){ setSelectedL([taskData?.data?.language]); - selectedLanguages.current?.push(taskData?.data?.language); + if (!selectedLanguages.current.includes(taskData?.data?.language)) { + selectedLanguages.current.push(taskData?.data?.language); + } } if(typeof taskData?.data?.ocr_domain === 'string' && taskData?.data?.ocr_domain !== ""){ ocrDomain.current = taskData?.data?.ocr_domain;