Skip to content

Fixes crash caused by ValueNodeWrapper rendering incorrect value #170

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/ValueNodeWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export const ValueNodeWrapper: React.FC<ValueNodeProps> = (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, inputProps)
)

return (
Expand Down Expand Up @@ -403,15 +403,15 @@ const getDataType = (value: unknown, customNodeData?: CustomNodeData) => {
return 'invalid'
}

const getInputComponent = (dataType: DataType, inputProps: InputProps) => {
const value = inputProps.value
const getInputComponent = (data: JsonData, inputProps: InputProps) => {
const dataType = getDataType(data)
switch (dataType) {
case 'string':
return <StringValue {...inputProps} value={value as string} />
return <StringValue {...inputProps} value={data as string} />
case 'number':
return <NumberValue {...inputProps} value={value as number} />
return <NumberValue {...inputProps} value={data as number} />
case 'boolean':
return <BooleanValue {...inputProps} value={value as boolean} />
return <BooleanValue {...inputProps} value={data as boolean} />
case 'null':
return <NullValue {...inputProps} />
default:
Expand Down