Closed parkerziegler closed 4 years ago
@parkerziegler I think I wasn't clear sorry. I'm not using getInitialProps at all. Not in my _app.js
and not in my pages. I'm just wrapping my _app
with withUrqlClient
and that's it. But since 0.3.0 and without touching my code, SSR stopped working.
Maybe I'm just misunderstanding, I'll try to apply this change and report back!
@jgoux thanks! If that's the case then we may have a bug. I can't repro in our local examples, granted those are quite trivial compared to a production app. If you can provide a CodeSandbox that minimally reproduces the issue that'd be super helpful!
A smol boi demonstrating usage of
getInitialProps
on an_app.js
component withnext-urql
. This is to clear up some questions on #35.While al
urql
queries will get picked up and run byreact-ssr-prepass
on the initial server render, there is a trick if you have blocking data requirements in a Page component that implementsgetInitialProps
and is wrapped by_app.js
. Basically, to ensure that Page'sgetInitialProps
is ran, you have to callNextApp.getInitialProps
: https://nextjs.org/docs/advanced-features/custom-appWe do have this in our second example, with the
Home
component having its owngetInitialProps
method. In order to have this function run, we need to add in this call toNextApp.getInitialProps
.cc/ @jgoux does this help? Your
urql
queries should still run fine in v0.3.0 if you're usinguseQuery
or theQuery
component. This only applies if you're implementinggetInitialProps
in your Page components.