-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
Prerequisites
- I have searched the existing issues
- I understand that providing a SSCCE example is tremendously useful to the maintainers.
- I have read the documentation
- Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
shadcn
Version
6.0.0-beta.12
Current Behavior
When using a form with additionalProperties like so:
function SomeComponent() {
return (
<Form
schema={{
properties: {
propTest: {
type: "object",
title: "Additional Property Test",
description: "Add additional properties.",
additionalProperties: { type: "string" },
},
}
}}
validator={validator}
/>
);
}Attempting to add a new property results in the new key being named propTest and the value being [object Object]. Inspecting the formData yields something like:
{ "propTest": {"propTest": {}}}Attempting to remove a property either:
- Adds the
propTestproperty if none exists, or - Does nothing if the
propTestproperty does exist
Expected Behavior
Expect to the new properties to be named newKey when clicking the add button, and the properties to be removed when clicking the remove button.
Steps To Reproduce
- Create a form with a nested
additionalPropertiesschema - Attempt to add or remove a property
Environment
- OS: Debian 12
- Node: v24.5.0
- npm: 11.5.1Anything else?
This issue appears to be due to the change to onDropPropertyClick in packages/core/src/components/fields/ObjectField.tsx in eb77ce9.
Since name gets added to the path downstream, the final call to onChange effectively gets called with onChange(copiedFormData, [name, name]) which results in the recursive propTest behavior from above.