This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
Add better support for _app.js. Move types to separate module. #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #36
This PR does a few things, most importantly fixing how
next-urql
returnspageProps
when wrapping an_app.js
component. We weren't handling this properly previously when running the prepass step._app.js
has a special props signature.in contrast to a regular Page component, which just consumes its props directly. The extra
pageProps
layer is something we needed to take into account in our HoC. Moreover, we also need to ensure we use the properctx
signature for_app.js
vs. Page components, as these structures differ as well. This PR adds anisApp
check insidegetInitialProps
such that we attachurqlClient
to the correctctx
object.In order to make a lot of this work, I loosened the types a bit by moving away from our generics. This is fine, since the HoC doesn't really care about any props coming in from the outside (it just forwards them along), and users can just specify their component's prop types in userland.
Finally, I moved our types into a separate
./types
module to make them easier to read ✅