rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.3k stars 2.19k forks source link

When using oneOf/dependencies default is not being populated #1416

Closed TrevorSundberg closed 1 year ago

TrevorSundberg commented 5 years ago

Prerequisites

Description

Default value does not appear when adding a value, using a combo of array, oneOf, and dependencies: https://mozilla-services.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJjb21wb25lbnRzIjpbeyJ0eXBlbmFtZSI6IkEifV19LCJzY2hlbWEiOnsicHJvcGVydGllcyI6eyJjb21wb25lbnRzIjp7Iml0ZW1zIjp7ImRlcGVuZGVuY2llcyI6eyJ0eXBlbmFtZSI6eyJvbmVPZiI6W3sicHJvcGVydGllcyI6eyJkYXRhIjp7InR5cGUiOiJvYmplY3QiLCJwcm9wZXJ0aWVzIjp7ImV4YW1wbGUiOnsidHlwZSI6InN0cmluZyIsImRlZmF1bHQiOiJ0ZXN0In19fSwidHlwZW5hbWUiOnsiZW51bSI6WyJBIl19fX0seyJwcm9wZXJ0aWVzIjp7ImRhdGEiOnsidHlwZSI6Im9iamVjdCIsInByb3BlcnRpZXMiOnsiZXhhbXBsZSI6eyJ0eXBlIjoic3RyaW5nIiwiZGVmYXVsdCI6InRlc3QifX19LCJ0eXBlbmFtZSI6eyJlbnVtIjpbIkIiXX19fV19fSwicHJvcGVydGllcyI6eyJ0eXBlbmFtZSI6eyJlbnVtIjpbIkEiLCJCIl0sInR5cGUiOiJzdHJpbmcifX0sInJlcXVpcmVkIjpbInR5cGVuYW1lIl0sInR5cGUiOiJvYmplY3QifSwidHlwZSI6ImFycmF5In19LCJ0eXBlIjoib2JqZWN0In0sInVpU2NoZW1hIjp7fX0=

Steps to Reproduce

  1. Click the above link in the playground.
  2. Remove and add a component
  3. Select type A or B
  4. Observe that the default value of test for field example is not populated.

Expected behavior

Expect the default value to appear in the example field.

Actual behavior

The example field is always empty and no default value is populated.

Version

"react-jsonschema-form": "^1.7.0",

TrevorSundberg commented 5 years ago

I would also just mention that I saw this PR was completed: https://github.com/mozilla-services/react-jsonschema-form/pull/1338 which is the reason I upgraded to 1.7.0, but this behavior is still occuring and occurs on the playground too (assuming the playground is running 1.7.0...)

MatinF commented 5 years ago

This would be really nice to get resolved, it would greatly simplify our form process

epicfaace commented 5 years ago

This will actually be fixed by #1376 -- see the following test case: https://github.com/rjsf-team/react-jsonschema-form/pull/1376/files#diff-0de170772e45d2602c103dd916607787R862

And the following playground links: first example second example

heath-freenome commented 1 year ago

This cannot be reproduced any more