To migrate to the new version, you will now have to pass a single function argument, instead
of two arguments to the withUrqlClient
HOC helper. For instance, you would have to transform this:
export default withUrqlClient(
ctx => ({
url: '',
}),
ssrExchange => [dedupExchange, cacheExchange, ssrExchange, fetchExchange]
);
To look like the following:
export default withUrqlClient((ssrExchange, ctx) => ({
url: '',
exchanges: [dedupExchange, cacheExchange, ssrExchange, fetchExchange]
}), { ssr; true });
The second argument may now be used to pass { ssr: true }
explicitly, when you are
wrapping a page without another getInitialProps
method. This gives you better support
when you're implement custom methods like getStaticProps
.
Major Changes
- Change
getInitialProps
to be applied when the wrapped pagegetInitialProps
or when{ ssr: true }
is passed as a second options object. This is to better support alternative methods likegetStaticProps
. By @JoviDeCroock (See #797) - Update the
withUrqlClient
function to remove the second argument formerly calledmergeExchanges
and merges it with the first argument.
Patch Changes
- Reuse the ssrExchange when there is one present on the client-side, by @JoviDeCroock (See #855)
- Updated dependencies (See #842)
- urql@1.9.8