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: reduce patch size to let users duplicate huge pages (#5400)
Bogdan Chadkin05d8baf21a2d
diff --git a/apps/builder/app/builder/shared/sync/sync-server.ts b/apps/builder/app/builder/shared/sync/sync-server.tsindex 8aabb582b6..b246acbcbd 100644--- a/apps/builder/app/builder/shared/sync/sync-server.ts+++ b/apps/builder/app/builder/shared/sync/sync-server.ts@@ -168,10 +168,18 @@ const syncServer = async function () {if (details.authToken) {headers.append("x-auth-token", details.authToken);}+ // revise patches are not used on the server and reduce possible patch size+ const optimizedTransactions = transactions.map((transaction) => ({+ ...transaction,+ payload: transaction.payload.map((change) => ({+ namespace: change.namespace,+ patches: change.patches,+ })),+ }));const response = await fetch(restPatchPath(), {method: "post",body: JSON.stringify({- transactions,+ transactions: optimizedTransactions,buildId: details.buildId,projectId,// provide latest stored version to serverdiff --git a/apps/builder/app/routes/rest.patch.ts b/apps/builder/app/routes/rest.patch.tsindex 920c07647b..162ca34c4b 100644--- a/apps/builder/app/routes/rest.patch.ts+++ b/apps/builder/app/routes/rest.patch.ts@@ -1,6 +1,5 @@-import { applyPatches, enableMapSet, enablePatches } from "immer";+import { applyPatches, enableMapSet, enablePatches, type Patch } from "immer";import type { ActionFunctionArgs } from "@remix-run/server-runtime";-import type { Change } from "immerhin";import {Breakpoints,Breakpoint,@@ -51,6 +50,11 @@ import { preventCrossOriginCookie } from "~/services/no-cross-origin-cookie";import { checkCsrf } from "~/services/csrf-session.server";import type { Transaction } from "~/shared/sync-client";+type Change = {+ namespace: string;+ patches: Array<Patch>;+};+type PatchData = {transactions: Transaction<Change[]>[];buildId: Build["id"];