Skip to content

Nested arrays button does not render nicely, and has no delete button #1124

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

Closed
chrisjohnson opened this issue Oct 23, 2018 · 6 comments
Closed
Assignees
Milestone

Comments

@chrisjohnson
Copy link

chrisjohnson commented Oct 23, 2018

Describe the bug

Using a schema like this:

{"$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array",
  "items":
  {"type": "object",
    "required": ["message"],
    "properties": {
      "message": {"type": "string"},
      "reject_codes": {"type": "array", "items": {"type": "string", "minLength": 1}}
    }
  }
}

The rendered interface is poor

To Reproduce
Steps to reproduce the behavior:

  1. Clone the seed demo app
  2. Set the schema as specified above
  3. Set uischema and data to undefined

Expected behavior
The button should be styled to match the rest of the form, and there should be a button to remove elements from the array

Screenshots
image

Browser (please complete the following information):

  • Chrome Version 69.0.3497.100 (Official Build) (64-bit)

Used Setup (please complete the following information):

  • Framework: react
  • RendererSet: material

Additional context
This appears to be exactly as it was screenshotted when the code to implement nested arrays was introduced: #994

So I'm not sure if this was just a temporary fix for a bug, or the intended behavior long-term, or what. I dug around in the code but I'm not very familiar with this codebase so it was hard for me to see why the standard array layout renderer wouldn't be used here

@chrisjohnson
Copy link
Author

chrisjohnson commented Oct 23, 2018

@edgarmueller I think you may have some thoughts on this. I am happy to try to help improve what's there if this was just a bandaid, but I could really use some guidance from somebody who has been thinking about this issue.

Honestly it may very well be that the solution here is for me to use a custom renderer but I'm a little lost about how I could crib from the existing array renderer for this (or better still, if that's possible, why not implement it upstream in the lib?)

@edgarmueller
Copy link
Contributor

edgarmueller commented Oct 24, 2018

@chrisjohnson Thanks for the report! Admittedly, the introduction of the array layout renderer was a bit rushed, so we'll need to address the issues.

@chrisjohnson
Copy link
Author

@eneufeld Please let me know if I can help provide feedback, test strategies, offer more insight into our use case, or even contribute to the solution. One thing to call out, I would really love to be able to specify the array uischema inline to the rest of the uischema -- rather than the current approach where you have to use registerUISchema with a tester that looks for my array, and it seems doable to me from a user context especially if it really properly becomes a first-class layout type.

@edgarmueller
Copy link
Contributor

The fix is part of 2.0.12-rc.3 and was fixed via #1146

@edgarmueller
Copy link
Contributor

Regarding your request about specifying the detail UI schema inline: please open another issue for this. Of course, we'd also be happy to receive any PRs. Thank you!

@chrisjohnson
Copy link
Author

Thank you very much, I'll work on testing this out over the next few days :)

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

No branches or pull requests

3 participants