Skip to content

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.

delete props separately for consistency

Roman Pominov3b7c89fc711c
diff --git a/packages/project/src/db/build.ts b/packages/project/src/db/build.ts
index 64b9c56dff..4338a2c5f2 100644
--- a/packages/project/src/db/build.ts
+++ b/packages/project/src/db/build.ts
@@ -146,6 +146,7 @@ export const deletePage = async (buildId: Build["id"], pageId: Page["id"]) => {
throw new Error(`Page with id "${pageId}" not found`);
}
+ await db.props.deleteByTreeId(page.treeId);
await db.tree.deleteById(page.treeId);
return {
diff --git a/packages/project/src/db/tree.ts b/packages/project/src/db/tree.ts
index 88e571446e..e8cd8a4863 100644
--- a/packages/project/src/db/tree.ts
+++ b/packages/project/src/db/tree.ts
@@ -3,7 +3,6 @@ import { applyPatches, type Patch } from "immer";
import { prisma } from "@webstudio-is/prisma-client";
import { Tree as DbTree } from "@prisma/client";
import { utils } from "../index";
-import { props } from ".";
export const createRootInstance = (breakpoints: Array<Breakpoint>) => {
// Take the smallest breakpoint as default
@@ -24,7 +23,6 @@ export const create = async (root: Instance): Promise<DbTree> => {
};
export const deleteById = async (treeId: string): Promise<void> => {
- await props.deleteByTreeId(treeId);
await prisma.tree.delete({ where: { id: treeId } });
};
@@ -48,7 +46,6 @@ export const clone = async (treeId: string) => {
if (tree === null) {
throw new Error(`Tree ${treeId} not found`);
}
- // @todo: clone props?
return await create(tree.root);
};