Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ should change the heading of the (upcoming) version to include a major version b
-->
# 6.0.0-beta.15

## @rjsf/core

- Updated `ObjectField` `onPropertyChange` duplicating path if provided with only one path to fix [#4733](https://github.com/rjsf-team/react-jsonschema-form/issues/4733)

## @rjsf/semantic-ui

- Updated `ArrayField` to stop using `nanoid` and instead use `lodash/uniqueId` to fix [#4762](https://github.com/rjsf-team/react-jsonschema-form/issues/4726)
Expand Down
25 changes: 14 additions & 11 deletions packages/core/src/components/fields/ObjectField.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Component } from 'react';
import {
getTemplate,
getUiOptions,
orderProperties,
ADDITIONAL_PROPERTY_FLAG,
ANY_OF_KEY,
ErrorSchema,
FieldProps,
FormContextType,
GenericObjectType,
getTemplate,
getUiOptions,
IdSchema,
ONE_OF_KEY,
orderProperties,
PROPERTIES_KEY,
REF_KEY,
RJSFSchema,
StrictRJSFSchema,
TranslatableString,
ADDITIONAL_PROPERTY_FLAG,
PROPERTIES_KEY,
REF_KEY,
ANY_OF_KEY,
ONE_OF_KEY,
} from '@rjsf/utils';
import Markdown from 'markdown-to-jsx';
import get from 'lodash/get';
import has from 'lodash/has';
import isObject from 'lodash/isObject';
import set from 'lodash/set';
import unset from 'lodash/unset';
import Markdown from 'markdown-to-jsx';
import { Component } from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this back to the top? We prefer react imports to be first


/** Type used for the state of the `ObjectField` component */
type ObjectFieldState = {
Expand Down Expand Up @@ -80,7 +80,10 @@ class ObjectField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends Fo
}
// Copy the current path and insert in the property name into the first location
const changePath = Array.isArray(path) ? path.slice() : [];
changePath.unshift(name);
// Ensure we are not duplicating the path
if (!changePath.length || changePath[0] !== name) {
Copy link
Member

@heath-freenome heath-freenome Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is similar code in ArrayField might I consider making a similar change there? AND there is one problem with this fix...if there were nested properties with the same name, this would cause problems with incorrect nesting.

Can you provide a codesandbox example where you are seeing this problem so that we can better understand why this failed for you.

I.e.

{
  "type": "object",
  "properties": {
    "foo": {
      "type": "object",
      "properties": {
        "foo": {
          "type": "string",
        }
      }
    }
  }
}

changePath.unshift(name);
}
onChange(value, changePath, newErrorSchema, id);
};
};
Expand Down