Skip to content

Bug report: Component crashes when onUpdate prevents changing data type to Object #169

Closed
@kyaw-t

Description

@kyaw-t

Describe the bug

The component crashes when the user tries to update a string/number/boolean to an object but the onUpdate function returns an error.

This seems to be happening because the ValueComponent tries to render it as a string/number/boolean even though the value it is trying to render is an object.

The screenshot shows that the dataType (string) is correct but the value it is trying to render is the value that was rejected by onUpdate.

Expected behavior

The component should not crash and should instead render the correct value

Screenshots

Image

Online demo

Steps to reproduce in code sandbox:
https://codesandbox.io/p/sandbox/json-edit-react-demo-forked-gc9z6x?file=%2Fsrc%2FApp.js%3A6%2C65

  • change type of hello to an object

Steps to reproduce in online demo:

  • select JSON Schema Validation for the demo data
  • change type of data.name from string to an object

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions