Skip to content
Merged
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
3 changes: 2 additions & 1 deletion apps/builder/app/shared/instance-utils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,8 @@ describe("delete instance", () => {
expect(data.instances.get("bodyId")?.children.length).toEqual(2);
deleteInstanceMutable(
data,
getInstancePath(["boxId", "bodyId"], data.instances)
// clone to make sure data is mutated instead of instance path
structuredClone(getInstancePath(["boxId", "bodyId"], data.instances))
);
expect(data.instances.size).toEqual(2);
expect(data.instances.get("bodyId")?.children.length).toEqual(1);
Expand Down
2 changes: 2 additions & 0 deletions apps/builder/app/shared/instance-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ export const deleteInstanceMutable = (
instanceIds
);

// mutate instances from data instead of instance path
parentInstance = data.instances.get(parentInstance?.id as string);
// may not exist when delete root
if (parentInstance) {
removeByMutable(
Expand Down
Loading