Skip to content

Commit 6daabed

Browse files
committed
Fix for when changing data type to illegal value
1 parent 54982fa commit 6daabed

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ValueNodeWrapper.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ export const ValueNodeWrapper: React.FC<ValueNodeProps> = (props) => {
165165
// that won't match the custom node condition any more
166166
customNodeData?.CustomNode ? translate('DEFAULT_STRING', nodeData) : undefined
167167
)
168-
updateValue(newValue as ValueData)
169168
onEdit(newValue, path).then((error) => {
170169
if (error) {
171170
onError({ code: 'UPDATE_ERROR', message: error }, newValue as JsonData)
@@ -405,13 +404,14 @@ const getDataType = (value: unknown, customNodeData?: CustomNodeData) => {
405404

406405
const getInputComponent = (data: JsonData, inputProps: InputProps) => {
407406
const dataType = getDataType(data)
407+
const { value } = inputProps
408408
switch (dataType) {
409409
case 'string':
410-
return <StringValue {...inputProps} value={data as string} />
410+
return <StringValue {...inputProps} value={value as string} />
411411
case 'number':
412-
return <NumberValue {...inputProps} value={data as number} />
412+
return <NumberValue {...inputProps} value={value as number} />
413413
case 'boolean':
414-
return <BooleanValue {...inputProps} value={data as boolean} />
414+
return <BooleanValue {...inputProps} value={value as boolean} />
415415
case 'null':
416416
return <NullValue {...inputProps} />
417417
default:

0 commit comments

Comments
 (0)