Skip to content

object fields being rendered with if-else inside allOfs have default values populated without being rendered #4575

@hatim-s

Description

@hatim-s

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

I have an array field with items as objects. The objects all have key, which is a oneOf, and has a default value. Now the item object has an optional property obj when is present if the key equals a specific value. This optional property also has it's own default value.

Issue:

Whenever I am adding a new array item, the form data also contains the default value for the field obj. This is a problem since the schema should not contain obj and should not contain it's default value in the form data.

Expected Behavior

No response

Steps To Reproduce

RJSF Playground Example

Steps

  1. Simply add an array item and track the form data. It adds the item, the default value for the key is correct, but the default for obj is also present.

Environment

- OS:
- Node:
- npm:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions