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.

rename stuffs

Andras Bacsaiddd7aa1aecd8
diff --git a/apps/designer/app/routes/canvas/$projectId.tsx b/apps/designer/app/routes/canvas/$projectId.tsx
index b24a39df17..9a6a4f6ee0 100644
--- a/apps/designer/app/routes/canvas/$projectId.tsx
+++ b/apps/designer/app/routes/canvas/$projectId.tsx
@@ -5,7 +5,7 @@ import { loadCanvasData, type ErrorData, type CanvasData } from "~/shared/db";
import env, { Env } from "~/env.server";
import { ErrorMessage } from "~/shared/error";
import { sentryException } from "~/shared/sentry";
-import { Canvas as CanvasDocument } from "@webstudio-is/react-sdk";
+import { Root } from "@webstudio-is/react-sdk";
type Data = (CanvasData | ErrorData) & { env: Env };
@@ -47,7 +47,7 @@ const CanvasRoute = () => {
if ("errors" in data) {
return <ErrorMessage message={data.errors} />;
}
- return <CanvasDocument Outlet={Outlet} />;
+ return <Root Outlet={Outlet} />;
};
export default CanvasRoute;
diff --git a/apps/designer/app/routes/index.tsx b/apps/designer/app/routes/index.tsx
index 88efd7ee32..7b0e662eee 100644
--- a/apps/designer/app/routes/index.tsx
+++ b/apps/designer/app/routes/index.tsx
@@ -1,10 +1,6 @@
import { type LoaderFunction, redirect } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
-import {
- type Data,
- Root,
- Canvas as CanvasDocument,
-} from "@webstudio-is/react-sdk";
+import { type Data, InstanceRoot, Root } from "@webstudio-is/react-sdk";
import config from "~/config";
import { db } from "@webstudio-is/project";
import env, { Env } from "~/env.server";
@@ -68,13 +64,13 @@ const Index = () => {
// We render the site from a subdomain
if (data.tree && data.props) {
- const Outlet = () => <Root data={data} />;
+ const Outlet = () => <InstanceRoot data={data} />;
// @todo This is non-standard for Remix, is there a better way?
// We need to render essentially the preview route but from the index,
// so we have to know the layout and the outlet from here.
// Maybe there is a way to tell remix to use the right outlet somehow and avoid passing it?
- return <CanvasDocument Outlet={Outlet} />;
+ return <Root Outlet={Outlet} />;
}
return null;
diff --git a/apps/designer/app/routes/preview/$projectId.tsx b/apps/designer/app/routes/preview/$projectId.tsx
index 76fa063d8f..84c8b002ae 100644
--- a/apps/designer/app/routes/preview/$projectId.tsx
+++ b/apps/designer/app/routes/preview/$projectId.tsx
@@ -1,8 +1,7 @@
import { useLoaderData } from "@remix-run/react";
import type { LoaderFunction, MetaFunction } from "@remix-run/node";
-import { Root } from "@webstudio-is/react-sdk";
-import { loadPreviewData, type PreviewData, type ErrorData } from "~/shared/db";
-import { Canvas as CanvasDocument } from "@webstudio-is/react-sdk";
+import { type ErrorData, loadPreviewData, type PreviewData } from "~/shared/db";
+import { InstanceRoot, Root } from "@webstudio-is/react-sdk";
import env, { Env } from "~/env.server";
export const meta: MetaFunction = () => {
@@ -36,7 +35,7 @@ export const loader: LoaderFunction = async ({ params }): LoaderReturnType => {
const Outlet = () => {
const data = useLoaderData<PreviewData>();
- return <Root data={data} />;
+ return <InstanceRoot data={data} />;
};
const PreviewRoute = () => {
@@ -44,7 +43,7 @@ const PreviewRoute = () => {
if ("errors" in data) {
return <p>{data.errors}</p>;
}
- return <CanvasDocument Outlet={Outlet} />;
+ return <Root Outlet={Outlet} />;
};
export default PreviewRoute;
diff --git a/packages/react-sdk/src/canvas/canvas.tsx b/packages/react-sdk/src/canvas/canvas.tsx
index 31e4689fe1..b20e8fb98e 100644
--- a/packages/react-sdk/src/canvas/canvas.tsx
+++ b/packages/react-sdk/src/canvas/canvas.tsx
@@ -4,7 +4,7 @@ import { CriticalCss } from "..";
/**
* We are using Outlet prop from index layout when user renders site from a subdomain.
*/
-export const Canvas = ({
+export const Root = ({
Outlet = DefaultOutlet,
}: {
Outlet: typeof DefaultOutlet;
diff --git a/packages/react-sdk/src/tree/root.ts b/packages/react-sdk/src/tree/root.ts
index 61c08a8e30..a267e98d59 100644
--- a/packages/react-sdk/src/tree/root.ts
+++ b/packages/react-sdk/src/tree/root.ts
@@ -25,7 +25,10 @@ type RootProps = {
Component?: (props: WrapperComponentProps) => JSX.Element;
};
-export const Root = ({ data, Component }: RootProps): JSX.Element | null => {
+export const InstanceRoot = ({
+ data,
+ Component,
+}: RootProps): JSX.Element | null => {
if (data.tree === null) {
throw new Error("Tree is null");
}