Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Add missing key property on NestFields #51

Open
pefernan opened this issue Sep 9, 2020 · 7 comments
Open

Add missing key property on NestFields #51

pefernan opened this issue Sep 9, 2020 · 7 comments

Comments

@pefernan
Copy link

pefernan commented Sep 9, 2020

When rendering a NestField this message appeares on console:

Warning: Each child in a list should have a unique "key" prop.
      Check the render method of 'Nest'. See https://fb.me/react-warning-keys for more information.
          in Fragment (created by Nest)
          in Nest (created by NestField)
          in NestField (created by AutoField)
          in AutoField (created by AutoFields)
          in div (created by AutoFields)
          in AutoFields (created by FormRenderer)
          in form (created by Form)
          in Form (created by AutoValidatedQuickPatternflyForm)
          in AutoValidatedQuickPatternflyForm (created by FormRenderer)
          in FormRenderer (created by WrapperComponent)
          in WrapperComponent

Looks like the key prop is missing.

@wtrocki
Copy link
Contributor

wtrocki commented Sep 9, 2020

Thank you for logging issue. We will address that problem in 24 hours.

@wtrocki
Copy link
Contributor

wtrocki commented Sep 9, 2020

Actually I see key being supplied but it might be duplicate on the field names in your schemas causing issue:

https://github.com/aerogear/uniforms-patternfly/blob/master/src/NestField.tsx#L39

I'm not at the computer right now but we have test and sample app that I will check once back from PTO tommorow

@wtrocki
Copy link
Contributor

wtrocki commented Sep 9, 2020

With just quick glance I cannot replicate it. it could be that key value is override by passed props.

Tests for nest fields passing.
Also nest field will have proper key.
https://github.com/aerogear/uniforms-patternfly/blob/master/src/AutoFields.tsx#L27

My take is it can be schema having duplicates or there is multiple nested fields that somehow clash (and I do not see test for it.

any more info will be good

@pefernan
Copy link
Author

pefernan commented Sep 9, 2020

@wtrocki I forgot to paste an example! You can try to reproduce it with this schema (https://github.com/kiegroup/kogito-apps/blob/master/ui-packages/packages/task-console/server/MockData/forms/ConfirmTravel.js).

Hoe it helps!

@wtrocki
Copy link
Contributor

wtrocki commented Sep 9, 2020

Oh.. yes. This really helps. I will look into this tommorow

@wtrocki
Copy link
Contributor

wtrocki commented Sep 10, 2020

Hi

I have dropped schema into the sample app and it seems to be working for me.
I have updated it for the master repository.

repro

Master has schema so it can be checked as well in the example app.

@wtrocki
Copy link
Contributor

wtrocki commented Sep 10, 2020

Is there branch where I can see the the most recent update of our package?
From package.json I see that there is couple libs outdated:

https://github.com/kiegroup/kogito-apps/blob/master/ui-packages/packages/task-console/package.json#L37-L39

Dependencies we work with (kinda forced by patternfly to use latest react etc)
https://github.com/aerogear/uniforms-patternfly/blob/master/examples/package.json#L13-L22

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

No branches or pull requests

2 participants