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

Specific invalid type breaks Form instead of rendering UnsupportedFieldTemplate #3875

Closed
4 tasks done
jroebu14 opened this issue Sep 20, 2023 · 2 comments · Fixed by #3897
Closed
4 tasks done

Specific invalid type breaks Form instead of rendering UnsupportedFieldTemplate #3875

jroebu14 opened this issue Sep 20, 2023 · 2 comments · Fixed by #3897

Comments

@jroebu14
Copy link
Contributor

jroebu14 commented Sep 20, 2023

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

There is a bug where Form won't render the UnsupportedFieldTemplate and instead break the app if the schema type is an array with the first element being a string or a number e.g.:

  • { type: "unsupported type" } -> renders the UnsupportedFieldTemplate
  • { type: ["unsupported type", "string"] } -> renders the UnsupportedFieldTemplate
  • { type: ["string", "unsupported type"] } -> breaks the form
  • { type: ["number", "unsupported type"] } -> breaks the form

Live examples of this below:

Unsupported schema type works

Unsupported schema type does not work

Expected Behavior

When the schema type is unsupported in any way it should render the UnsupportedFieldTemplate and not break the Form.

This should include e.g.:

  • { type: ["string", "unsupported type"] }
  • { type: ["number", "unsupported type"] }

Steps To Reproduce

Create a form with the following schema

{
  title: "Test form",
  type: ["string", "unsupported type"]
};

e.g.:

Observe that UnsupportedFieldTemplate does not render and the app/Form throws an exception.

Environment

- OS: Mac 13.5.1
- Node: 18.6.0
- npm: 9.5.1

Anything else?

No response

@jroebu14 jroebu14 added bug needs triage Initial label given, to be assigned correct labels and assigned labels Sep 20, 2023
@heath-freenome
Copy link
Member

@jroebu14 Interesting that ordering is making a difference. Is this something you are willing to try and fix? We maintainers are pretty busy with our regular jobs and have maybe 2 hours a week to spend on fixes

@heath-freenome heath-freenome added core help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 6, 2023
@jroebu14
Copy link
Contributor Author

jroebu14 commented Oct 8, 2023

@heath-freenome yeh I'm happy to try and fix. I had a look and I think I know where the issue is. I'll try and post a PR very soon.

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

Successfully merging a pull request may close this issue.

2 participants