rjsf-team/react-jsonschema-form

Form values don't get reinitialized from defaults when toggling between anyOf/oneOf options

開放

#3,736 建立於 2023年6月19日

 (5 則留言) (0 個反應) (0 位負責人)TypeScript (2,136 個分叉)batch import
any-one-all-ofbugdefaultshelp wanted

倉庫指標

星標
 (13,175 顆星)
PR 合併指標
 (平均合併 3天 17小時) (30 天內合併 32 個 PR)

描述

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

When one of the options from anyOf/oneOf is rendered, the default values get set properly. However, after you switch to a different option, then go back, all the defaults will be gone.

Expected Behavior

The defaults should get set every time someone changes the subschema version

Steps To Reproduce

  1. Go to https://rjsf-team.github.io/react-jsonschema-form/
  2. Click the "Any Of" example
  3. Notice that "First method of identification" is selected, and "First name" is set to the default value, "Chuck"
  4. In the render view, change to "Second method of identification"
  5. In the render view, change to "First method of identification"

Current: "First name" is empty Expected: "First name" is set to the default value, "Chuck"

Environment

- OS: Windows 11
- Node & npm: whatever you use on your playground

Anything else?

image

貢獻者指南