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 projects endpoint

Andras Bacsai81ee438a81e8
diff --git a/apps/designer/app/routes/rest/project.$projectId.tsx b/apps/designer/app/routes/rest/project.$projectId.tsx
index aac108ca4b..683c474dd1 100644
--- a/apps/designer/app/routes/rest/project.$projectId.tsx
+++ b/apps/designer/app/routes/rest/project.$projectId.tsx
@@ -35,9 +35,15 @@ export const loader: ActionFunction = async ({ request, params }) => {
pages: { homePage, pages },
} = prodBuild;
const breakpoints = await db.breakpoints.load(prodBuild.id);
+ const tree = await db.tree.loadById(homePage.treeId);
+ if (tree === null) {
+ throw json("Tree structure not found. Please contact us to get help.", {
+ status: 500,
+ });
+ }
pagesDetails["/"] = {
page: homePage,
- tree: await db.tree.loadById(homePage.treeId),
+ tree,
props: await db.props.loadByTreeId(homePage.treeId),
css: await generateCssText({
projectId,
diff --git a/packages/http-client/src/index.d.ts b/packages/http-client/src/index.d.ts
index 5d7771e3d9..35bdc41498 100644
--- a/packages/http-client/src/index.d.ts
+++ b/packages/http-client/src/index.d.ts
@@ -9,11 +9,13 @@ export type Page = {
root: [string, string];
};
export type Project = {
- [string]: {
- page: Page;
- tree: BaseInstance | null;
- props: Array<UserProp> | [];
- breakpoints: Array<Breakpoint> | null;
- css: string;
- };
+ [string]:
+ | {
+ page: Page;
+ tree: BaseInstance;
+ props: Array<UserProp> | [];
+ breakpoints: Array<Breakpoint> | null;
+ css: string;
+ }
+ | string;
};