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
chore: Remove single() PostgREST calls from Build to improve compression (#3969)
Ivan Starkovf60b9bddb170
diff --git a/packages/project-build/src/db/build.ts b/packages/project-build/src/db/build.tsindex 78e5b665aa..b3e8107516 100644--- a/packages/project-build/src/db/build.ts+++ b/packages/project-build/src/db/build.ts@@ -130,14 +130,20 @@ export const loadRawBuildById = async (const build = await context.postgrest.client.from("Build").select("*")- .eq("id", id)- .single();+ .eq("id", id);+ // .single(); Note: Single response is not compressed. Uncomment the following line once the issue is resolved: https://github.com/orgs/supabase/discussions/28757if (build.error) {throw build.error;}- return build.data;+ if (build.data.length !== 1) {+ throw new Error(+ `Results contain ${build.data.length} row(s) requires 1 row`+ );+ }++ return build.data[0];};export const loadBuildById = async (@@ -157,14 +163,20 @@ export const loadBuildIdAndVersionByProjectId = async (.from("Build").select("id,version").eq("projectId", projectId)- .is("deployment", null)- .single();+ .is("deployment", null);+ // .single(); Note: Single response is not compressed. Uncomment the following line once the issue is resolved: https://github.com/orgs/supabase/discussions/28757if (build.error) {throw build.error;}- return build.data;+ if (build.data.length !== 1) {+ throw new Error(+ `Results contain ${build.data.length} row(s) requires 1 row`+ );+ }++ return build.data[0];};const loadRawBuildByProjectId = async (@@ -175,12 +187,20 @@ const loadRawBuildByProjectId = async (.from("Build").select("*").eq("projectId", projectId)- .is("deployment", null)- .single();+ .is("deployment", null);+ // .single(); Note: Single response is not compressed. Uncomment the following line once the issue is resolved: https://github.com/orgs/supabase/discussions/28757+if (build.error) {throw build.error;}- return build.data;++ if (build.data.length !== 1) {+ throw new Error(+ `Results contain ${build.data.length} row(s) requires 1 row`+ );+ }++ return build.data[0];};export const loadBuildByProjectId = async (@@ -225,12 +245,20 @@ export const loadApprovedProdBuildByProjectId = async (const build = await context.postgrest.client.from("Build").select()- .eq("id", latestBuild.data.buildId)- .single();+ .eq("id", latestBuild.data.buildId);+ // .single(); Note: Single response is not compressed. Uncomment the following line once the issue is resolved: https://github.com/orgs/supabase/discussions/28757+if (build.error) {throw build.error;}- return parseCompactBuild(build.data);++ if (build.data.length !== 1) {+ throw new Error(+ `Results contain ${build.data.length} row(s) requires 1 row`+ );+ }++ return parseCompactBuild(build.data[0]);};const createNewPageInstances = (): Build["instances"] => {