Skip to content

Commit a0f0172

Browse files
committed
Revert datatype calculation
1 parent 54b4537 commit a0f0172

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ValueNodeWrapper.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export const ValueNodeWrapper: React.FC<ValueNodeProps> = (props) => {
273273
) : (
274274
// Need to re-fetch data type to make sure it's one of the "core" ones
275275
// when fetching a non-custom component
276-
getInputComponent(dataType, inputProps)
276+
getInputComponent(data, inputProps)
277277
)
278278

279279
return (
@@ -401,9 +401,14 @@ const getDataType = (value: unknown, customNodeData?: CustomNodeData) => {
401401
return 'invalid'
402402
}
403403

404-
const getInputComponent = (dataType: string, inputProps: InputProps) => {
404+
const getInputComponent = (data: JsonData, inputProps: InputProps) => {
405+
// Need to check for DataType again -- if it's a custom component it could
406+
// have a custom type, but it we're rendering this (a standard component),
407+
// then it must be set to not show in current condition (editing or view), so
408+
// we need interpret it as a simple type, not the Custom type.
409+
const rawDataType = getDataType(data)
405410
const { value } = inputProps
406-
switch (dataType) {
411+
switch (rawDataType) {
407412
case 'string':
408413
return <StringValue {...inputProps} value={value as string} />
409414
case 'number':

0 commit comments

Comments
 (0)