What are you trying to do? (please be as specific as possible and include relevant screenshots, code snippets, and reproduction steps)
We are building a Nextjs app using Plasmic and the codegen approach.
The following code is my pages/reviews.tsx file, which represents the Reviews page in my Plasmic editor:
// This is a skeleton starter React page generated by Plasmic.
// This file is owned by you, feel free to edit as you see fit.
import * as React from "react";
import { PageParamsProvider as PageParamsProvider__ } from "@plasmicapp/react-web/lib/host";
import GlobalContextsProvider from "../components/plasmic/archer_trade_log_mvp/PlasmicGlobalContextsProvider";
import { PlasmicReviews } from "../components/plasmic/archer_trade_log_mvp/PlasmicReviews";
import { useRouter } from "next/router";
function Reviews() {
// Use PlasmicReviews to render this component as it was
// designed in Plasmic, by activating the appropriate variants,
// attaching the appropriate event handlers, etc. You
// can also install whatever React hooks you need here to manage state or
// fetch data.
//
// Props you can pass into PlasmicReviews are:
// 1. Variants you want to activate,
// 2. Contents for slots you want to fill,
// 3. Overrides for any named node in the component to attach behavior and data,
// 4. Props to set on the root node.
//
// By default, PlasmicReviews is wrapped by your project's global
// variant context providers. These wrappers may be moved to
// Next.js Custom App component
// (https://nextjs.org/docs/advanced-features/custom-app).
return (
<GlobalContextsProvider>
<PageParamsProvider
route={useRouter()?.pathname}
params={useRouter()?.query}
query={useRouter()?.query}
>
<PlasmicReviews />
</PageParamsProvider>
</GlobalContextsProvider>
);
}
export default Reviews;
Our question
I want to add code that makes sure that any built-in Plasmic data integrations used on this page (or any of its child components) are pre-fetched using SSR.
How is this typically done, when using the codegen approach?
Is there a concrete code example?
We have read and processed the entire Plasmic documentation multiple times and explored multiple AI engines to generate example code, but did not find a concrete way yet to achieve this, for the codegen approach at least.
Thanks in advance!
Other than that, we absolutely love what you guys are doing! Plasmic has quickly become a solid part of in-house way of working of building custom applications/solutions for our customers.
Kind regards,
Stijn De Vos