From 67f0775f88fba8cfbe2c23cf58b3e50325be2ef1 Mon Sep 17 00:00:00 2001 From: kyaw-t <90881094+kyaw-t@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:34:32 -0500 Subject: [PATCH 1/3] added data parameter to getInputComponent --- src/ValueNodeWrapper.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ValueNodeWrapper.tsx b/src/ValueNodeWrapper.tsx index fc294538..674fa866 100644 --- a/src/ValueNodeWrapper.tsx +++ b/src/ValueNodeWrapper.tsx @@ -275,7 +275,7 @@ export const ValueNodeWrapper: React.FC = (props) => { ) : ( // Need to re-fetch data type to make sure it's one of the "core" ones // when fetching a non-custom component - getInputComponent(getDataType(data) as DataType, inputProps) + getInputComponent(data, getDataType(data) as DataType, inputProps) ) return ( @@ -403,15 +403,14 @@ const getDataType = (value: unknown, customNodeData?: CustomNodeData) => { return 'invalid' } -const getInputComponent = (dataType: DataType, inputProps: InputProps) => { - const value = inputProps.value +const getInputComponent = (data:unknown, dataType: DataType, inputProps: InputProps) => { switch (dataType) { case 'string': - return + return case 'number': - return + return case 'boolean': - return + return case 'null': return default: From 7ce800c866667a1d2d9e6fe1bf3791c0085d9e34 Mon Sep 17 00:00:00 2001 From: kyaw Date: Wed, 12 Feb 2025 19:11:46 -0500 Subject: [PATCH 2/3] Update src/ValueNodeWrapper.tsx Co-authored-by: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> --- src/ValueNodeWrapper.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ValueNodeWrapper.tsx b/src/ValueNodeWrapper.tsx index 674fa866..ead40416 100644 --- a/src/ValueNodeWrapper.tsx +++ b/src/ValueNodeWrapper.tsx @@ -403,7 +403,8 @@ const getDataType = (value: unknown, customNodeData?: CustomNodeData) => { return 'invalid' } -const getInputComponent = (data:unknown, dataType: DataType, inputProps: InputProps) => { +const getInputComponent = (data: JsonData, inputProps: InputProps) => { + const dataType = getDataType(data) switch (dataType) { case 'string': return From 3799f03ffdc36bbcc21a8c6917ec5da1a95da997 Mon Sep 17 00:00:00 2001 From: kyaw Date: Wed, 12 Feb 2025 19:11:51 -0500 Subject: [PATCH 3/3] Update src/ValueNodeWrapper.tsx Co-authored-by: Carl Smith <5456533+CarlosNZ@users.noreply.github.com> --- src/ValueNodeWrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ValueNodeWrapper.tsx b/src/ValueNodeWrapper.tsx index ead40416..0247231a 100644 --- a/src/ValueNodeWrapper.tsx +++ b/src/ValueNodeWrapper.tsx @@ -275,7 +275,7 @@ export const ValueNodeWrapper: React.FC = (props) => { ) : ( // Need to re-fetch data type to make sure it's one of the "core" ones // when fetching a non-custom component - getInputComponent(data, getDataType(data) as DataType, inputProps) + getInputComponent(data, inputProps) ) return (