Skip to content

Commit 5a6d9bd

Browse files
fix(ui): failing test cases for form manip utils
1 parent c6621d5 commit 5a6d9bd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

invokeai/frontend/web/src/features/nodes/components/sidePanel/builder/form-manipulation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('workflow builder form manipulation', () => {
8080
index: 0,
8181
});
8282

83-
expect(getElement(form, el.id, isContainerElement).parentId).toBe(form.rootElementId);
83+
expect(getElement(form, el.id).parentId).toBe(form.rootElementId);
8484
});
8585

8686
it('should add the element at the given index', () => {

invokeai/frontend/web/src/features/nodes/components/sidePanel/builder/form-manipulation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ export const addElement = (args: {
125125
const { form, element, parentId, index } = args;
126126
const { elements } = form;
127127

128+
if (element.id in elements) {
129+
// Element already exists
130+
return false;
131+
}
132+
128133
const parent = elements[parentId];
129134
if (!parent || !isContainerElement(parent)) {
130135
return false;

0 commit comments

Comments
 (0)