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

Form becomes unresponsive when "liveOmit" and "omitExtraData" props are turned on for schemas containing fixed array of objects #3909

Closed
4 tasks done
Rozamo opened this issue Oct 17, 2023 · 9 comments · Fixed by #3916

Comments

@Rozamo
Copy link
Contributor

Rozamo commented Oct 17, 2023

Prerequisites

What theme are you using?

core

Version

5.13.2

Current Behavior

I am using the following schema in the playground with liveOmit and omitExtraData turned on

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "properties": {
    "array": {
      "type": "array",
      "items": [
        {
          "properties": {
            "title": {
              "type": "string"
            }
          }
        }
      ]
    }
  }
}

Upon typing anything in the title input box, the focus shifts away from the input box and there is no change in the input box or the form data

Expected Behavior

The data entered should be reflected in the title input box and the form data.

Steps To Reproduce

  1. Go the the rjsf playground
  2. Turn on the liveOmit and omitExtraData props
  3. Try to enter some data in the title input box
  4. The focus is lost and there is no change in the input box or the form data

Environment

- OS: macOS 13.5.1 
- Node: 18.15.0
- npm: 9.5.0

Anything else?

@Rozamo Rozamo added bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 17, 2023
@Rozamo Rozamo changed the title Form becomes unresponsive when "liveOmit" and "omitExtraData" props are turned on for schemas containing array of objects Form becomes unresponsive when "liveOmit" and "omitExtraData" props are turned on for schemas containing fixed array of objects Oct 18, 2023
@Rozamo
Copy link
Contributor Author

Rozamo commented Oct 18, 2023

@epicfaace Would like to contribute here. Don't have the permission to push the branch though. Can you please help here.

@Rozamo
Copy link
Contributor Author

Rozamo commented Oct 20, 2023

@heath-freenome @nickgros Please check this.

@nickgros
Copy link
Contributor

@Rozamo thanks for the report. This is definitely a bad bug! Do you have any time to investigate this? We would be happy to help point you to likely places in code and review a PR.

@nickgros nickgros added help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 20, 2023
@Rozamo
Copy link
Contributor Author

Rozamo commented Oct 21, 2023

@Rozamo thanks for the report. This is definitely a bad bug! Do you have any time to investigate this? We would be happy to help point you to likely places in code and review a PR.

@nickgros Yes, I do. I have identified the issue and made changes in my local repo. But I am unable to push the branch to remote. Can you please help with the permission.

@nickgros
Copy link
Contributor

@Rozamo You can create a forked repository in GitHub and push your changes to your forked repo. You can then open a pull request comparing the branch on your forked repo to the RJSF main branch

@Rozamo
Copy link
Contributor Author

Rozamo commented Oct 21, 2023

Thanks @nickgros. Have created a PR #3916 for this.

@anya92
Copy link

anya92 commented Nov 9, 2023

Hi @heath-freenome,

I wonder if these changes were really necessary. The JSON schema looked incorrect from the start because you can't use an array to define "items". According to the JSON Schema specification "The value of "items" MUST be a valid JSON Schema" (https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.1.2) and "A JSON Schema MUST be an object or a boolean” (https://json-schema.org/draft/2020-12/json-schema-core#section-4.3).

I had to go back to a version before this change because my JSON schemas stopped working after that.

Here is an example of a schema that stopped working after this change (it works fine with the previous version of the package) - rjsf playground.

You can see that otherProperty is rendered correctly according to the if...then condition and is correctly validated, so the JSON schema is correct. However, you cannot change the value of this property when the liveOmit and omitExtraData checkboxes are selected.

@Rozamo
Copy link
Contributor Author

Rozamo commented Nov 14, 2023

@anya92 Not sure if the issue you're facing is related to this fix. I tried the schema that you provided in the earlier version (15.13.2) and it's not working there either.

Also, the schema provided in the issue description is correct according to the draft 07 version which is the default used in rjsf. Please check the Draft-specific info of the Tuple validation section to see the changes.

@heath-freenome
Copy link
Member

@anya92 Can you create an issue for this? Please reference this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants