question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FieldTemplate children are in an array

See original GitHub issue

Prerequisites

Description

Since release 1.2.0 (and more specifically #1118), children passed to FieldTemplate are in an array.

Steps to Reproduce

  1. Open the playground on the Simple example.
  2. Using the React Developer Tools, inspect the first FieldTemplate component and its props.

image

Expected behavior

children should be a node.

Actual behavior

children is an Array with 2 extra null items.

Version

1.2.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ivarprudnikovcommented, Apr 21, 2020

It depends and in theory could be a breaking change. If anyone was cloning props.children through cloneElement() and doing something with contents then it will break after merge. Because developer will get one fragment instead of field along with optional anyOf, oneOf placeholders. But I do not know if anyone would do that ever.

Also it is not clear what issue creator @mlbstrm was doing with children for this to be an issue at all. Same question could be asked @ketysek as he mentioned that was a problem for his field templates.

In addition to the above if this is something meant only for v2 then PR could be merged. v2 implies there are breaking changes anyway.

0reactions
epicfaacecommented, Apr 25, 2020

fixed by #1709

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Templates - react-jsonschema-form documentation
Each of the items represent a child with properties described below. ... To fully customize an array field template, you may need to...
Read more >
Custom UI in react jsonschema form for ArrayFieldTemplate
I want to show the input type="text" and button inside a table. There are few other fields also in the array {element.children.props.formData} ...
Read more >
Loop through child elements in Twig like Element::children()
I have created a Twig filter that returns back with the children as an ArrayIterator . mymodule ...
Read more >
How to render individual field values instead of {{ children }}
By default, the template just dumps out {{ children }} and ... {{ dump(_context|keys) }} = array(21) { [0]=> string(7) "element" [1]=> ...
Read more >
JavaScript Drop Down Box Configuration - DevExtreme
Built-in buttons should also be declared in this array. ... In the following code, the fieldTemplate is used to stylize the text field...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found