create-plasmic-app 0.0.98 → 0.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +2 -1
- package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +2 -1
- package/cpa-out/gatsby-codegen-js/package.json +4 -4
- package/cpa-out/gatsby-codegen-js/plasmic.json +14 -8
- package/cpa-out/gatsby-codegen-js/src/components/Button.jsx +1 -3
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +53 -100
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +36 -30
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +3 -15
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +25 -25
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +45 -59
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +3 -3
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
- package/cpa-out/gatsby-codegen-js/src/pages/dynamic/[slug].jsx +5 -4
- package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +5 -4
- package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +2 -1
- package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +2 -1
- package/cpa-out/gatsby-codegen-ts/package.json +9 -9
- package/cpa-out/gatsby-codegen-ts/plasmic.json +14 -8
- package/cpa-out/gatsby-codegen-ts/src/components/Button.tsx +4 -5
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +99 -75
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +80 -49
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +3 -15
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +69 -43
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +90 -77
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +4 -4
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
- package/cpa-out/gatsby-codegen-ts/src/pages/dynamic/[slug].tsx +6 -5
- package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +6 -5
- package/cpa-out/gatsby-loader-js/package.json +3 -3
- package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +1 -0
- package/cpa-out/gatsby-loader-ts/package.json +8 -8
- package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +1 -0
- package/cpa-out/nextjs-app-loader-js/package.json +8 -6
- package/cpa-out/nextjs-app-loader-js/plasmic-init.js +10 -1
- package/cpa-out/nextjs-app-loader-ts/package.json +12 -10
- package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +10 -1
- package/cpa-out/nextjs-app-loader-ts/tsconfig.json +2 -9
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +6 -5
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/package.json +4 -4
- package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +2 -1
- package/cpa-out/nextjs-pages-codegen-js/plasmic.json +2 -2
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -14
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +7 -7
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -7
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -7
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
- package/cpa-out/nextjs-pages-codegen-ts/package.json +4 -4
- package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +2 -1
- package/cpa-out/nextjs-pages-codegen-ts/pages/dynamic/[slug].tsx +1 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +1 -0
- package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +2 -2
- package/cpa-out/nextjs-pages-loader-js/package.json +3 -3
- package/cpa-out/nextjs-pages-loader-ts/package.json +3 -3
- package/cpa-out/react-codegen-js/eslint.config.js +1 -6
- package/cpa-out/react-codegen-js/package.json +10 -11
- package/cpa-out/react-codegen-js/plasmic.json +2 -2
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +6 -5
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
- package/cpa-out/react-codegen-ts/package.json +11 -11
- package/cpa-out/react-codegen-ts/plasmic.json +2 -2
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -14
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +7 -7
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -7
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -7
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
- package/dist/index.js +7 -8
- package/dist/utils/file-utils.d.ts +2 -2
- package/dist/utils/file-utils.js +29 -28
- package/package.json +5 -13
- package/run-cpa.ts +8 -6
- package/src/index.ts +7 -9
- package/src/utils/file-utils.ts +44 -30
- package/.eslintrc.js +0 -15
- package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +0 -56
- package/cpa-out/nextjs-app-loader-js/app/api/hello/route.js +0 -3
- package/cpa-out/nextjs-app-loader-js/app/layout.js +0 -14
- package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +0 -6
- package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +0 -65
- package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +0 -59
- package/cpa-out/nextjs-app-loader-ts/app/api/hello/route.ts +0 -3
- package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +0 -18
- package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +0 -6
- package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +0 -65
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
|
|
2
|
-
import { notFound } from "next/navigation";
|
|
3
|
-
import { PLASMIC } from "@/plasmic-init";
|
|
4
|
-
import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
|
|
5
|
-
|
|
6
|
-
// Use revalidate if you want incremental static regeneration
|
|
7
|
-
export const revalidate = 60;
|
|
8
|
-
|
|
9
|
-
export default async function PlasmicLoaderPage({
|
|
10
|
-
params,
|
|
11
|
-
searchParams,
|
|
12
|
-
}) {
|
|
13
|
-
const plasmicComponentData = await fetchPlasmicComponentData(params?.catchall);
|
|
14
|
-
if (!plasmicComponentData) {
|
|
15
|
-
notFound();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const { prefetchedData } = plasmicComponentData;
|
|
19
|
-
if (prefetchedData.entryCompMetas.length === 0) {
|
|
20
|
-
notFound();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const pageMeta = prefetchedData.entryCompMetas[0];
|
|
24
|
-
return (
|
|
25
|
-
<ClientPlasmicRootProvider
|
|
26
|
-
prefetchedData={prefetchedData}
|
|
27
|
-
pageParams={pageMeta.params}
|
|
28
|
-
pageQuery={searchParams}
|
|
29
|
-
>
|
|
30
|
-
<PlasmicComponent
|
|
31
|
-
component={pageMeta.displayName}
|
|
32
|
-
/>
|
|
33
|
-
</ClientPlasmicRootProvider>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function fetchPlasmicComponentData(catchall) {
|
|
38
|
-
const plasmicPath = "/" + (catchall ? catchall.join("/") : "");
|
|
39
|
-
const prefetchedData = await PLASMIC.maybeFetchComponentData(plasmicPath);
|
|
40
|
-
if (!prefetchedData) {
|
|
41
|
-
notFound();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return { prefetchedData };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export async function generateStaticParams() {
|
|
48
|
-
const pageModules = await PLASMIC.fetchPages();
|
|
49
|
-
return pageModules.map((mod) => {
|
|
50
|
-
const catchall =
|
|
51
|
-
mod.path === "/" ? undefined : mod.path.substring(1).split("/");
|
|
52
|
-
return {
|
|
53
|
-
catchall,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import './globals.css'
|
|
2
|
-
|
|
3
|
-
export const metadata = {
|
|
4
|
-
title: 'Create Next App',
|
|
5
|
-
description: 'Generated by create next app',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function RootLayout({ children }) {
|
|
9
|
-
return (
|
|
10
|
-
<html lang="en">
|
|
11
|
-
<body>{children}</body>
|
|
12
|
-
</html>
|
|
13
|
-
)
|
|
14
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
|
|
4
|
-
import { PLASMIC } from "@/plasmic-init";
|
|
5
|
-
|
|
6
|
-
// You can register any code components that you want to use here; see
|
|
7
|
-
// https://docs.plasmic.app/learn/code-components-ref/
|
|
8
|
-
// And configure your Plasmic project to use the host url pointing at
|
|
9
|
-
// the /plasmic-host page of your nextjs app (for example,
|
|
10
|
-
// http://localhost:3000/plasmic-host). See
|
|
11
|
-
// https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
|
|
12
|
-
|
|
13
|
-
// PLASMIC.registerComponent(...);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* ClientPlasmicRootProvider is a Client Component that passes in the loader for you.
|
|
17
|
-
*
|
|
18
|
-
* Why? Props passed from Server to Client Components must be serializable.
|
|
19
|
-
* https://beta.nextjs.org/docs/rendering/server-and-client-components#passing-props-from-server-to-client-components-serialization
|
|
20
|
-
* However, PlasmicRootProvider requires a loader, but the loader is NOT serializable.
|
|
21
|
-
*
|
|
22
|
-
* In a Server Component like app/<your-path>/path.tsx, rendering the following would not work:
|
|
23
|
-
*
|
|
24
|
-
* ```tsx
|
|
25
|
-
* import { PLASMIC } from "@/plasmic-init";
|
|
26
|
-
* import { PlasmicRootProvider } from "plasmicapp/loader-nextjs";
|
|
27
|
-
* export default function MyPage() {
|
|
28
|
-
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
29
|
-
* return (
|
|
30
|
-
* <PlasmicRootProvider
|
|
31
|
-
* loader={PLASMIC} // ERROR: loader is not serializable
|
|
32
|
-
* prefetchedData={prefetchedData}
|
|
33
|
-
* >
|
|
34
|
-
* {yourContent()}
|
|
35
|
-
* </PlasmicRootProvider>;
|
|
36
|
-
* );
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* Therefore, we define ClientPlasmicRootProvider as a Client Component (this file is marked "use client").
|
|
41
|
-
* ClientPlasmicRootProvider wraps the PlasmicRootProvider and passes in the loader for you,
|
|
42
|
-
* while allowing your Server Component to pass in prefetched data and other serializable props:
|
|
43
|
-
*
|
|
44
|
-
* ```tsx
|
|
45
|
-
* import { PLASMIC } from "@/plasmic-init";
|
|
46
|
-
* import { ClientPlasmicRootProvider } from "@/plasmic-init-client"; // changed
|
|
47
|
-
* export default function MyPage() {
|
|
48
|
-
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
49
|
-
* return (
|
|
50
|
-
* <ClientPlasmicRootProvider // don't pass in loader
|
|
51
|
-
* prefetchedData={prefetchedData}
|
|
52
|
-
* >
|
|
53
|
-
* {yourContent()}
|
|
54
|
-
* </ClientPlasmicRootProvider>;
|
|
55
|
-
* );
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export function ClientPlasmicRootProvider(
|
|
60
|
-
props
|
|
61
|
-
) {
|
|
62
|
-
return (
|
|
63
|
-
<PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
|
|
2
|
-
import { notFound } from "next/navigation";
|
|
3
|
-
import { PLASMIC } from "@/plasmic-init";
|
|
4
|
-
import { ClientPlasmicRootProvider } from "@/plasmic-init-client";
|
|
5
|
-
|
|
6
|
-
// Use revalidate if you want incremental static regeneration
|
|
7
|
-
export const revalidate = 60;
|
|
8
|
-
|
|
9
|
-
export default async function PlasmicLoaderPage({
|
|
10
|
-
params,
|
|
11
|
-
searchParams,
|
|
12
|
-
}: {
|
|
13
|
-
params?: { catchall: string[] | undefined };
|
|
14
|
-
searchParams?: Record<string, string | string[]>;
|
|
15
|
-
}) {
|
|
16
|
-
const plasmicComponentData = await fetchPlasmicComponentData(params?.catchall);
|
|
17
|
-
if (!plasmicComponentData) {
|
|
18
|
-
notFound();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const { prefetchedData } = plasmicComponentData;
|
|
22
|
-
if (prefetchedData.entryCompMetas.length === 0) {
|
|
23
|
-
notFound();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const pageMeta = prefetchedData.entryCompMetas[0];
|
|
27
|
-
return (
|
|
28
|
-
<ClientPlasmicRootProvider
|
|
29
|
-
prefetchedData={prefetchedData}
|
|
30
|
-
pageParams={pageMeta.params}
|
|
31
|
-
pageQuery={searchParams}
|
|
32
|
-
>
|
|
33
|
-
<PlasmicComponent
|
|
34
|
-
component={pageMeta.displayName}
|
|
35
|
-
/>
|
|
36
|
-
</ClientPlasmicRootProvider>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function fetchPlasmicComponentData(catchall: string[] | undefined) {
|
|
41
|
-
const plasmicPath = "/" + (catchall ? catchall.join("/") : "");
|
|
42
|
-
const prefetchedData = await PLASMIC.maybeFetchComponentData(plasmicPath);
|
|
43
|
-
if (!prefetchedData) {
|
|
44
|
-
notFound();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return { prefetchedData };
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export async function generateStaticParams() {
|
|
51
|
-
const pageModules = await PLASMIC.fetchPages();
|
|
52
|
-
return pageModules.map((mod) => {
|
|
53
|
-
const catchall =
|
|
54
|
-
mod.path === "/" ? undefined : mod.path.substring(1).split("/");
|
|
55
|
-
return {
|
|
56
|
-
catchall,
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import './globals.css'
|
|
2
|
-
|
|
3
|
-
export const metadata = {
|
|
4
|
-
title: 'Create Next App',
|
|
5
|
-
description: 'Generated by create next app',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default function RootLayout({
|
|
9
|
-
children,
|
|
10
|
-
}: {
|
|
11
|
-
children: React.ReactNode
|
|
12
|
-
}) {
|
|
13
|
-
return (
|
|
14
|
-
<html lang="en">
|
|
15
|
-
<body>{children}</body>
|
|
16
|
-
</html>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
|
|
4
|
-
import { PLASMIC } from "@/plasmic-init";
|
|
5
|
-
|
|
6
|
-
// You can register any code components that you want to use here; see
|
|
7
|
-
// https://docs.plasmic.app/learn/code-components-ref/
|
|
8
|
-
// And configure your Plasmic project to use the host url pointing at
|
|
9
|
-
// the /plasmic-host page of your nextjs app (for example,
|
|
10
|
-
// http://localhost:3000/plasmic-host). See
|
|
11
|
-
// https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
|
|
12
|
-
|
|
13
|
-
// PLASMIC.registerComponent(...);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* ClientPlasmicRootProvider is a Client Component that passes in the loader for you.
|
|
17
|
-
*
|
|
18
|
-
* Why? Props passed from Server to Client Components must be serializable.
|
|
19
|
-
* https://beta.nextjs.org/docs/rendering/server-and-client-components#passing-props-from-server-to-client-components-serialization
|
|
20
|
-
* However, PlasmicRootProvider requires a loader, but the loader is NOT serializable.
|
|
21
|
-
*
|
|
22
|
-
* In a Server Component like app/<your-path>/path.tsx, rendering the following would not work:
|
|
23
|
-
*
|
|
24
|
-
* ```tsx
|
|
25
|
-
* import { PLASMIC } from "@/plasmic-init";
|
|
26
|
-
* import { PlasmicRootProvider } from "plasmicapp/loader-nextjs";
|
|
27
|
-
* export default function MyPage() {
|
|
28
|
-
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
29
|
-
* return (
|
|
30
|
-
* <PlasmicRootProvider
|
|
31
|
-
* loader={PLASMIC} // ERROR: loader is not serializable
|
|
32
|
-
* prefetchedData={prefetchedData}
|
|
33
|
-
* >
|
|
34
|
-
* {yourContent()}
|
|
35
|
-
* </PlasmicRootProvider>;
|
|
36
|
-
* );
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* Therefore, we define ClientPlasmicRootProvider as a Client Component (this file is marked "use client").
|
|
41
|
-
* ClientPlasmicRootProvider wraps the PlasmicRootProvider and passes in the loader for you,
|
|
42
|
-
* while allowing your Server Component to pass in prefetched data and other serializable props:
|
|
43
|
-
*
|
|
44
|
-
* ```tsx
|
|
45
|
-
* import { PLASMIC } from "@/plasmic-init";
|
|
46
|
-
* import { ClientPlasmicRootProvider } from "@/plasmic-init-client"; // changed
|
|
47
|
-
* export default function MyPage() {
|
|
48
|
-
* const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
|
|
49
|
-
* return (
|
|
50
|
-
* <ClientPlasmicRootProvider // don't pass in loader
|
|
51
|
-
* prefetchedData={prefetchedData}
|
|
52
|
-
* >
|
|
53
|
-
* {yourContent()}
|
|
54
|
-
* </ClientPlasmicRootProvider>;
|
|
55
|
-
* );
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export function ClientPlasmicRootProvider(
|
|
60
|
-
props: Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">
|
|
61
|
-
) {
|
|
62
|
-
return (
|
|
63
|
-
<PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>
|
|
64
|
-
);
|
|
65
|
-
}
|