React-jsonschema-form: Removing properties from schema (as demonstrated in "conditional fields" example) does not remove field from rendered form

Created on 18 Jul 2017  路  8Comments  路  Source: rjsf-team/react-jsonschema-form

Prerequisites

  • [x] I have read the documentation;
  • [x] In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.

Description

Removing a property from (a clone of) the schema does not remove the field from the form

Steps to Reproduce

  1. Open the "conditional fields" example linked to from the project page (https://jsfiddle.net/69z2wepo/68259/)
  2. Tick the box to cause the "Name" field to be displayed
  3. Untick the box

Expected behavior

The name field should disappear

Actual behavior

The name field doesn't disappear

Version

0.49.0

Most helpful comment

Thanks. That was all a lot less scary than it seemed ;)

All 8 comments

I guess it is because you are adding it if it is checked but no removing it if it is unchecked.

I didn't write the code, it's an example from https://github.com/mozilla-services/react-jsonschema-form#tips-and-tricks (so I presumed that it was meant to work as-is).

The code example does actually remove them, but it does it by mutating the schema.properties instead of replacing it with a modified clone.

https://jsfiddle.net/69z2wepo/83018/ is a working version of the original example. I would suggest that you guys update the example link to the fixed version.

@LyraelRayne would you like to send a pull-request with that modification?

I'm not really sure how to go about that (never done one on github). Do I have to make a fork or something?

EDIT: Worked it out :)

Quick question: Do I have to keep the fork around once the pull request is merged?

Nope :)

Thanks. That was all a lot less scary than it seemed ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

epicfaace picture epicfaace  路  3Comments

MedinaGitHub picture MedinaGitHub  路  3Comments

anttivikman picture anttivikman  路  3Comments

videni picture videni  路  3Comments

FBurner picture FBurner  路  3Comments