aerogear / uniforms-patternfly

Uniforms patternfly
Apache License 2.0
13 stars 10 forks source link

Add missing key property on NestFields #51

Open pefernan opened 4 years ago

pefernan commented 4 years ago

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 commented 4 years ago

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

wtrocki commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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

wtrocki commented 4 years ago

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 commented 4 years ago

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