Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: cleanup parent children when delete instances (#4859)
Bogdan Chadkinba3c96409510
diff --git a/apps/builder/app/shared/instance-utils.test.tsx b/apps/builder/app/shared/instance-utils.test.tsxindex f0b7f088b1..9e0070b1e9 100644--- a/apps/builder/app/shared/instance-utils.test.tsx+++ b/apps/builder/app/shared/instance-utils.test.tsx@@ -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);diff --git a/apps/builder/app/shared/instance-utils.ts b/apps/builder/app/shared/instance-utils.tsindex cf36cc04cd..dd764142c1 100644--- a/apps/builder/app/shared/instance-utils.ts+++ b/apps/builder/app/shared/instance-utils.ts@@ -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 rootif (parentInstance) {removeByMutable(