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.

Fix build create (#923)

Ivan Starkovf063d7e2d510
diff --git a/packages/project/src/db/build.ts b/packages/project/src/db/build.ts
index f8c3ff4705..2599234763 100644
--- a/packages/project/src/db/build.ts
+++ b/packages/project/src/db/build.ts
@@ -258,6 +258,13 @@ export async function create(
? (await db.breakpoints.load(sourceBuild.id)).values
: db.breakpoints.createValues();
+ if (env === "prod") {
+ await client.build.updateMany({
+ where: { projectId: projectId, isProd: true },
+ data: { isProd: false },
+ });
+ }
+
const build = await client.build.create({
data: {
projectId,
@@ -274,13 +281,6 @@ export async function create(
? await createPages({ projectId, buildId: build.id }, client)
: await clonePages(sourceBuild.pages, client);
- if (env === "prod") {
- await client.build.updateMany({
- where: { projectId: projectId, isProd: true },
- data: { isProd: false },
- });
- }
-
await client.build.update({
where: {
id: build.id,