From 3b1872dd4c5c5c3fca6c307af6009ff46decd9e3 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 28 Aug 2023 13:31:50 -0300 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9B=20fix(inputListComponent):=20f?= =?UTF-8?q?ix=20type=20error=20when=20value=20is=20a=20string=20by=20conve?= =?UTF-8?q?rting=20it=20to=20an=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/components/inputListComponent/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index eb8ca2b5f..90920bf39 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -18,6 +18,8 @@ export default function InputListComponent({ } }, [disabled]); + typeof value === 'string' ? value = [value] : value = value; + return (
Date: Mon, 28 Aug 2023 13:51:42 -0300 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20fix(inputListComponent):=20c?= =?UTF-8?q?onvert=20value=20to=20an=20array=20when=20it's=20a=20string=20t?= =?UTF-8?q?o=20avoid=20errors=20in=20InputListComponent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/components/inputListComponent/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 90920bf39..37d5c6e7f 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -18,6 +18,7 @@ export default function InputListComponent({ } }, [disabled]); + //Sometimes value is a string, but the InputListComponent expects an array, so we need to convert it when it's a string to an array with the string inside it to avoid errors typeof value === 'string' ? value = [value] : value = value; return ( From c6f6e2008e5f856f8742d55c38ee1ee520d31e68 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 28 Aug 2023 13:52:49 -0300 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=80=20refactor(inputListComponent)?= =?UTF-8?q?:=20improve=20code=20readability=20and=20handle=20value=20conve?= =?UTF-8?q?rsion=20from=20string=20to=20array=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 📝 WHY: The InputListComponent expects an array format for the value prop, but sometimes it receives a string instead. To prevent errors and ensure smooth operation, we need to handle the conversion from a string to an array with the string as its element. This refactor improves code readability and clarifies the purpose of the value conversion logic. --- src/frontend/src/components/inputListComponent/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 37d5c6e7f..105ba4c3c 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -18,7 +18,7 @@ export default function InputListComponent({ } }, [disabled]); - //Sometimes value is a string, but the InputListComponent expects an array, so we need to convert it when it's a string to an array with the string inside it to avoid errors + // In certain cases, the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element. typeof value === 'string' ? value = [value] : value = value; return ( From dc3db7ce78bb516d2db49185001c1b0aab4ba40e Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 28 Aug 2023 13:59:01 -0300 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=A7=20chore(inputListComponent):?= =?UTF-8?q?=20add=20TODO=20comment=20for=20handling=20conversion=20from=20?= =?UTF-8?q?string=20to=20array=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 chore(inputListComponent): add recursive character text splitter to handle conversion from string to array format --- src/frontend/src/components/inputListComponent/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 105ba4c3c..a1f58789f 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -18,7 +18,7 @@ export default function InputListComponent({ } }, [disabled]); - // In certain cases, the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element. + // @TODO Recursive Character Text Splitter - the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element. typeof value === 'string' ? value = [value] : value = value; return (