rjsf-team/react-jsonschema-form

Properties whose available options change via dependency creates an unresolvable state for users

Open

#4.465 aberto em 23 de jan. de 2025

Ver no GitHub
 (4 comments) (1 reaction) (0 assignees)TypeScript (2.136 forks)batch import
featurehelp wanted

Métricas do repositório

Stars
 (13.175 stars)
Métricas de merge de PR
 (Mesclagem média 3d 17h) (32 fundiu PRs em 30d)

Description

Prerequisites

What theme are you using?

core

Version

5.24.1

Current Behavior

When I create a property dependency and the dependent property is an array with multiple options whose options change based on the dependency, if I start to select options, then switch the dependent field, the formdata does not clear the invalid options.

Expected Behavior

Invalid array options are cleared when the available list of options changes

Steps To Reproduce

Playground Sandbox Link

  1. Create a property with a selectable option, say product type {'fruit', 'dairy'}
  2. Create a dependent property that is an array whose options change, 'fruit' -> 'apple', 'banana' and 'dairy' -> 'milk', 'cheese'
  3. Selecting 'apple' then switching to 'dairy' leaves a user in an uncorrectable state because 'apple' stays in the form data

See the video of me demonstrating it with the Playground Sandbox

https://github.com/user-attachments/assets/7a9ccbc3-ef25-4a97-a23d-b6c9fe10a1f5

Environment

- OS:
- Node:
- npm:

Anything else?

No response

Guia do colaborador