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: Meta hydration errors on published sites (#3054)

Ivan Starkovdd63547c8dc0
diff --git a/fixtures/webstudio-custom-template/.webstudio/data.json b/fixtures/webstudio-custom-template/.webstudio/data.json
index f00fed8907..2c915b9cef 100644
--- a/fixtures/webstudio-custom-template/.webstudio/data.json
+++ b/fixtures/webstudio-custom-template/.webstudio/data.json
@@ -1,10 +1,10 @@
{
"build": {
- "id": "7c038d94-8a94-4ecb-a048-69da407986f2",
+ "id": "013a3982-43b2-4c80-90a6-fc306a5bdf2d",
"projectId": "0d856812-61d8-4014-a20a-82e01c0eb8ee",
- "version": 147,
- "createdAt": "2024-03-17T18:28:52.083Z",
- "updatedAt": "2024-03-17T18:28:52.083Z",
+ "version": 192,
+ "createdAt": "2024-03-26T14:06:11.500Z",
+ "updatedAt": "2024-03-26T14:06:11.500Z",
"pages": {
"meta": {
"siteName": "Fixture Site",
@@ -1247,6 +1247,66 @@
"type": "boolean",
"value": false
}
+ ],
+ [
+ "iqfFtqv6cjN4nb3w91dNq",
+ {
+ "id": "iqfFtqv6cjN4nb3w91dNq",
+ "instanceId": "ffuOk2adQRwdmAPbN0C02",
+ "name": "code",
+ "type": "string",
+ "value": "<script>console.log('PAGE MAIN SSR')</script>\n<script>console.log('PAGE MAIN 2 SSR')</script>\nSCRIPTS ARE HERE <br>"
+ }
+ ],
+ [
+ "K1pxEPsRa_Nt-wkIQEfjY",
+ {
+ "id": "K1pxEPsRa_Nt-wkIQEfjY",
+ "instanceId": "fx0TfnvHfudZ99agcyokN",
+ "name": "code",
+ "type": "string",
+ "value": "<br>\n<script>console.log('SCRIPT TEST SSR')</script>\n<script>console.log('SCRIPT TEST SSR 2')</script>\nSCRIPTS ARE HERE 2<br>"
+ }
+ ],
+ [
+ "unR2CL4WDfk00zIJpg8u_",
+ {
+ "id": "unR2CL4WDfk00zIJpg8u_",
+ "instanceId": "PI0W8MDhnG1glS5zDm8HQ",
+ "name": "code",
+ "type": "string",
+ "value": "<script>console.log('PAGE MAIN Client')</script>\n<script>console.log('PAGE MAIN 2 Client')</script>\nSCRIPTS ARE HERE <br>"
+ }
+ ],
+ [
+ "jrV4n4y5NOVhwRIDKkuo-",
+ {
+ "id": "jrV4n4y5NOVhwRIDKkuo-",
+ "instanceId": "PI0W8MDhnG1glS5zDm8HQ",
+ "name": "clientOnly",
+ "type": "boolean",
+ "value": true
+ }
+ ],
+ [
+ "jGj9meMRShEuCpWmHRy91",
+ {
+ "id": "jGj9meMRShEuCpWmHRy91",
+ "instanceId": "evFyHvPu9rGzKojoj723b",
+ "name": "code",
+ "type": "string",
+ "value": "<script>console.log('SCRIPTS TEST Client')</script>\n<script>console.log('SCRIPTS TEST 2 Client')</script>\nSCRIPTS ARE HERE <br>"
+ }
+ ],
+ [
+ "H2no86fAFL-WHxdVu6CJ4",
+ {
+ "id": "H2no86fAFL-WHxdVu6CJ4",
+ "instanceId": "evFyHvPu9rGzKojoj723b",
+ "name": "clientOnly",
+ "type": "boolean",
+ "value": true
+ }
]
],
"dataSources": [
@@ -1291,6 +1351,14 @@
"type": "id",
"value": "7pwqBSgrfuuOfk1JblWcL"
},
+ {
+ "type": "id",
+ "value": "PI0W8MDhnG1glS5zDm8HQ"
+ },
+ {
+ "type": "id",
+ "value": "ffuOk2adQRwdmAPbN0C02"
+ },
{
"type": "id",
"value": "QzTSoZnbGD6luZ5xcv893"
@@ -1330,6 +1398,14 @@
{
"type": "id",
"value": "8MXByradrqVRiGSyHI0aH"
+ },
+ {
+ "type": "id",
+ "value": "fx0TfnvHfudZ99agcyokN"
+ },
+ {
+ "type": "id",
+ "value": "evFyHvPu9rGzKojoj723b"
}
]
}
@@ -1498,6 +1574,46 @@
"label": "Spinner SVG",
"children": []
}
+ ],
+ [
+ "ffuOk2adQRwdmAPbN0C02",
+ {
+ "type": "instance",
+ "id": "ffuOk2adQRwdmAPbN0C02",
+ "component": "HtmlEmbed",
+ "label": "SSR",
+ "children": []
+ }
+ ],
+ [
+ "fx0TfnvHfudZ99agcyokN",
+ {
+ "type": "instance",
+ "id": "fx0TfnvHfudZ99agcyokN",
+ "component": "HtmlEmbed",
+ "label": "SSR",
+ "children": []
+ }
+ ],
+ [
+ "PI0W8MDhnG1glS5zDm8HQ",
+ {
+ "type": "instance",
+ "id": "PI0W8MDhnG1glS5zDm8HQ",
+ "component": "HtmlEmbed",
+ "label": "CLient",
+ "children": []
+ }
+ ],
+ [
+ "evFyHvPu9rGzKojoj723b",
+ {
+ "type": "instance",
+ "id": "evFyHvPu9rGzKojoj723b",
+ "component": "HtmlEmbed",
+ "label": "CLient",
+ "children": []
+ }
]
],
"deployment": {
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
index 63282aa03d..0c27a20498 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
@@ -8,7 +8,10 @@ import {
Body as Body,
Link as Link,
} from "@webstudio-is/sdk-components-react-remix";
-import { Heading as Heading } from "@webstudio-is/sdk-components-react";
+import {
+ Heading as Heading,
+ HtmlEmbed as HtmlEmbed,
+} from "@webstudio-is/sdk-components-react";
export const favIconAsset: ImageAsset | undefined = {
id: "cd1e9fad-8df1-45c6-800f-05fda2d2469f",
@@ -44,6 +47,21 @@ const Page = ({}: { system: any }) => {
>
{"Go Home"}
</Link>
+ <HtmlEmbed
+ data-ws-id="fx0TfnvHfudZ99agcyokN"
+ data-ws-component="HtmlEmbed"
+ code={
+ "<br>\n<script>console.log('SCRIPT TEST SSR')</script>\n<script>console.log('SCRIPT TEST SSR 2')</script>\nSCRIPTS ARE HERE 2<br>"
+ }
+ />
+ <HtmlEmbed
+ data-ws-id="evFyHvPu9rGzKojoj723b"
+ data-ws-component="HtmlEmbed"
+ code={
+ "<script>console.log('SCRIPTS TEST Client')</script>\n<script>console.log('SCRIPTS TEST 2 Client')</script>\nSCRIPTS ARE HERE <br>"
+ }
+ clientOnly={true}
+ />
</Body>
);
};
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts b/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts
index 3f5e54fc00..7fa2ff3666 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts
+++ b/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts
@@ -2,15 +2,15 @@ export const sitemap = {
pages: [
{
path: "",
- lastModified: "2024-03-17T18:28:52.083Z",
+ lastModified: "2024-03-26T14:06:11.500Z",
},
{
path: "/script-test",
- lastModified: "2024-03-17T18:28:52.083Z",
+ lastModified: "2024-03-26T14:06:11.500Z",
},
{
path: "/world",
- lastModified: "2024-03-17T18:28:52.083Z",
+ lastModified: "2024-03-26T14:06:11.500Z",
},
],
};
diff --git a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
index 5bec6fe5eb..64338d3593 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
@@ -73,6 +73,21 @@ const Page = ({}: { system: any }) => {
>
{"DO NOT TOUCH THIS PROJECT, IT'S USED FOR FIXTURES"}
</Heading>
+ <HtmlEmbed
+ data-ws-id="PI0W8MDhnG1glS5zDm8HQ"
+ data-ws-component="HtmlEmbed"
+ code={
+ "<script>console.log('PAGE MAIN Client')</script>\n<script>console.log('PAGE MAIN 2 Client')</script>\nSCRIPTS ARE HERE <br>"
+ }
+ clientOnly={true}
+ />
+ <HtmlEmbed
+ data-ws-id="ffuOk2adQRwdmAPbN0C02"
+ data-ws-component="HtmlEmbed"
+ code={
+ "<script>console.log('PAGE MAIN SSR')</script>\n<script>console.log('PAGE MAIN 2 SSR')</script>\nSCRIPTS ARE HERE <br>"
+ }
+ />
<Link
data-ws-id="QzTSoZnbGD6luZ5xcv893"
data-ws-component="Link"
diff --git a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
index 53f9ac6ab6..acd1baa0e1 100644
--- a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
index 987c5efc9e..cd005e7be6 100644
--- a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-custom-template/app/routes/_index.tsx b/fixtures/webstudio-custom-template/app/routes/_index.tsx
index 522783bf19..5d5254650b 100644
--- a/fixtures/webstudio-custom-template/app/routes/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/_index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
index 522783bf19..5d5254650b 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
index 522783bf19..5d5254650b 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
index e73b66aa2e..ccc9bface8 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
index 610c402baf..dea0012db6 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
index 6ec4e5c7e8..71b2d2ea42 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx
index dc6a1251bb..e4f2afb139 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
index 4c03bd23e7..5bbc5fb3cb 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
index 38c156d53b..0225c0fc1c 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
index 522783bf19..5d5254650b 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({
diff --git a/packages/cli/templates/defaults/__templates__/route-template.tsx b/packages/cli/templates/defaults/__templates__/route-template.tsx
index 1714d8eaa3..225fc466cd 100644
--- a/packages/cli/templates/defaults/__templates__/route-template.tsx
+++ b/packages/cli/templates/defaults/__templates__/route-template.tsx
@@ -69,6 +69,7 @@ export const loader = async (arg: LoaderArgs) => {
system,
resources,
pageMeta,
+ projectMeta,
},
// No way for current information to change, so add cache for 10 minutes
// In case of CRM Data, this should be set to 0
@@ -94,7 +95,7 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
if (data === undefined) {
return metas;
}
- const { pageMeta } = data;
+ const { pageMeta, projectMeta } = data;
if (data.url) {
metas.push({