Skip to content
New issue

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

By clicking “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? Sign in to your account

When the form has initial data and the schema is updated, the form throws an error #131

Closed
bhch opened this issue Nov 28, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bhch
Copy link
Owner

bhch commented Nov 28, 2023

Steps to reproduce:

Step 1. Original schema:

{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "title": "Example",
      "oneOf": [
        {
          "title": "Table",
          "properties": {
            "type": {
              "type": "string",
              "default": "table",
              "widget": "hidden"
            },
            "columns": {
              "title": "Columns",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "title": "Header"
                  },
                  "type": {
                    "type": "string",
                    "title": "Type",
                    "choices": [
                      "string",
                      "number",
                      "integer",
                      "boolean"
                    ],
                    "default": "string",
                    "required": true
                  },
                  "default": {
                    "type": "array",
                    "title": "Prepopulate rows (EN)",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}

Step 2: Add some data and save the object.

Step 3: Update the schema to this:

{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "title": "Example",
      "oneOf": [
        {
          "title": "Table",
          "properties": {
            "type": {
              "type": "string",
              "default": "table",
              "widget": "hidden"
            },
            "columns": {
              "title": "Columns",
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "title": "Header"
                  },
                  "type": {
                    "type": "string",
                    "title": "Type",
                    "choices": [
                      "string",
                      "number",
                      "integer",
                      "boolean"
                    ],
                    "default": "string",
                    "required": true
                  },
                  "default": {
                    "type": "array",
                    "title": "Prepopulate rows (EN)",
                    "items": {
                      "type": "string"
                    }
                  },
                  "default_de": {
                    "type": "array",
                    "title": "Prepopulate rows (DE)",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  }
}

Step 4: Refresh page

The admin widget doesn't render with the following message:
Screenshot 2023-11-28 at 10 02 20 AM

I was using 2.17.0 earlier but upgraded to 2.21.0 but the problem still persists.

Originally posted by @sgocg in #101 (comment)

@bhch
Copy link
Owner Author

bhch commented Dec 2, 2023

@sgocg This has been fixed in v2.21.1. Please upgrade and test it out.

Thank you for reporting the issue.


UPDATE: Just released a new version v.2.21.2 (previous release had a small mistake left in the logic).

@sgocg
Copy link

sgocg commented Dec 5, 2023

Amazing, thanks for the fix! I tested it locally and it works quite well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants