Skip to content

Commit 978b67e

Browse files
committed
fix undefined items
1 parent 55faac6 commit 978b67e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/ui/src/components/json-schema-builder/constraints/ValueConstraints.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ const ValueConstraints = ({ attribute, onUpdate }) => {
3232
const updateValueConstraint = (updates) => {
3333
if (isSimpleArray) {
3434
// Place enum/const inside items for simple arrays
35-
onUpdate({
36-
items: {
37-
...attribute.items,
38-
...updates,
39-
},
35+
// Need to handle undefined values by explicitly removing keys
36+
const newItems = { ...attribute.items };
37+
Object.keys(updates).forEach((key) => {
38+
if (updates[key] === undefined) {
39+
delete newItems[key];
40+
} else {
41+
newItems[key] = updates[key];
42+
}
4043
});
44+
onUpdate({ items: newItems });
4145
} else {
4246
onUpdate(updates);
4347
}

0 commit comments

Comments
 (0)