Open CallumBoase opened 2 months ago
Important update: The error described above SupabaseProvider does not actually break SSR for the entire page.
To replicate this:
extractPlasmicQueryData()
inside getStaticProps
, add a console.log
console.log(JSON.stringify(queryCache))
This is therefore not a major problem and errors can be safely ignored (until we wish to support server side rendering from Plasmic-Supabase including for SSG and ISR see https://github.com/CallumBoase/plasmic-supabase/issues/6)
CONTEXT:
Plasmic-supabase component "SupabaseProvider" (and others) are known as data-fetching code components in Plasmic
On the default [[...catchall]].tsx page generated when you publish a Plasmic App to nextjs with App Loader,
getStaticProps()
runsextractPlasmicQueryData()
to SSR fetch data insideusePlasmicQueryData()
via theextractPlasmicQueryData()
function. If any data is fetched, the results are cached and sent to the client-side component as props (main component:PlasmicLoaderPage
) See doc: https://docs.plasmic.app/learn/data-code-components/#how-extractplasmicquerydata-worksplasmic-supabase does not currently fetch data using
usePlasmicQueryData()
and so this behaviour doesn't result in any server side data-fetching (although we want to support this in future see https://github.com/CallumBoase/plasmic-supabase/issues/6)PROBLEM
SupabaseProvider
component is present on a page, when the react-ssr-prepass runs ingetStaticProps
we get an error about document being undefined (see below).usePlasmicQueryData()
currently).However the error will presumably disable server side data fetching & caching (and therefore Incremental Static Regeneration and/or Static Site Generation) completely on the page (which is not good if some other data source that does support server-side data fetching is also being used on that page)update: it will not break other server-side data fetches on the page (see comment below)The error that we get in terminal of your dev server
HOW TO REPLICATE
[[...catchall]].tsx
page, comment out this code from thegetStaticProps()
functionand replace with
localhost:3000
and the error in terminal should be gone, indicating that the error is caused by the attempt to fetch data server-side as described above.