This PR adds support for exposing the Next context object from getInitialProps in the setup for the urql Client in withUrqlClient. If users want to, they can now access ctx directly like so:
export default withUrqlClient(ctx => {
// You can now access ctx when creating your client options.
return {
url: 'http://localhost:3000',
fetchOptions: {
headers: {
Authorization: ctx.token
}
}
};
})(Component);
I also added a whole bunch of unit tests with enzyme for withUrqlClient to give us some assurances around how this API is working. The previous API will still work, so this change is fully backwards compatible and can be released in 0.2.0. There are some more specifics I'll call out in the PR for interested parties // reviewers.
Fix #3.
This PR adds support for exposing the Next context object from
getInitialProps
in the setup for theurql
Client inwithUrqlClient
. If users want to, they can now accessctx
directly like so:I also added a whole bunch of unit tests with
enzyme
forwithUrqlClient
to give us some assurances around how this API is working. The previous API will still work, so this change is fully backwards compatible and can be released in 0.2.0. There are some more specifics I'll call out in the PR for interested parties // reviewers.