next-urql
Advanced tools
Comparing version 0.3.1 to 0.3.2
# Changelog | ||
## 0.3.2 | ||
### Patch Changes | ||
- Pass the `Client` down in `withUrqlClient.getInitialProps` to prevent it from being created twice, by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#589](https://github.com/FormidableLabs/urql/pull/589)) | ||
- Add missing GraphQLError serialization for extensions and path field to ssrExchange, by [@kitten](https://github.com/kitten) (See [#607](https://github.com/FormidableLabs/urql/pull/607)) | ||
- Enable users to configure the `suspense` option and clean up suspense warning message, by [@ryan-gilb](https://github.com/ryan-gilb) (See [#603](https://github.com/FormidableLabs/urql/pull/603)) | ||
## 0.3.1 | ||
@@ -4,0 +12,0 @@ |
@@ -43,3 +43,3 @@ function _interopDefault(ex) { | ||
urqlClient = urql.createClient(_extends({}, clientOptions, { | ||
suspense: isServer, | ||
suspense: isServer || clientOptions.suspense, | ||
exchanges: mergeExchanges(ssrCache) | ||
@@ -93,3 +93,5 @@ })); | ||
if ("undefined" != typeof window) { | ||
return pageProps; | ||
return _extends({}, pageProps, { | ||
urqlClient: urqlClient | ||
}); | ||
} | ||
@@ -96,0 +98,0 @@ var props = _extends({}, pageProps, { |
@@ -1,2 +0,2 @@ | ||
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("react")),n=e(require("react-ssr-prepass")),r=require("urql");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a=null,u=null;function o(e){return[r.dedupExchange,r.cacheExchange,e,r.fetchExchange]}function c(e,t,n){void 0===t&&(t=o);var c="undefined"==typeof window;return!c&&a||(u=r.ssrExchange({initialState:n}),a=r.createClient(i({},e,{suspense:c,exchanges:t(u)}))),[a,u]}function l(e){return[r.dedupExchange,r.cacheExchange,e,r.fetchExchange]}exports.withUrqlClient=function(e,a){return void 0===a&&(a=l),function(u){var o,l=function(n){var o=n.urqlClient,l=n.urqlState,f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}(n,["urqlClient","urqlState"]),s=t.useMemo((function(){var t="function"==typeof e?e():e;return o||c(t,a,l)[0]}),[o,l]);return t.createElement(r.Provider,{value:s},t.createElement(u,i({urqlClient:s},f)))};return l.displayName="withUrqlClient("+((o=u).displayName||o.name||"Component")+")",l.getInitialProps=function(r){function o(){return i({},q,{urqlState:g?g.extractData():void 0})}function l(){if("undefined"!=typeof window)return q;var e=i({},q,{urqlClient:d});return Promise.resolve(n(t.createElement(s,i({},p?e:{pageProps:e})))).then(o)}function f(e){q=e}try{var s=r.AppTree,p=!!r.Component,h=p?r.ctx:r,v=c("function"==typeof e?e(h):e,a),d=v[0],g=v[1];d&&(h.urqlClient=d);var q={};const t=function(){if(u.getInitialProps)return Promise.resolve(u.getInitialProps(r)).then(f)}();return Promise.resolve(t&&t.then?t.then(l):l())}catch(e){return Promise.reject(e)}},l}}; | ||
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("react")),n=e(require("react-ssr-prepass")),r=require("urql");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var u=null,a=null;function o(e){return[r.dedupExchange,r.cacheExchange,e,r.fetchExchange]}function c(e,t,n){void 0===t&&(t=o);var c="undefined"==typeof window;return!c&&u||(a=r.ssrExchange({initialState:n}),u=r.createClient(i({},e,{suspense:c||e.suspense,exchanges:t(a)}))),[u,a]}function l(e){return[r.dedupExchange,r.cacheExchange,e,r.fetchExchange]}exports.withUrqlClient=function(e,u){return void 0===u&&(u=l),function(a){var o,l=function(n){var o=n.urqlClient,l=n.urqlState,f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}(n,["urqlClient","urqlState"]),s=t.useMemo((function(){var t="function"==typeof e?e():e;return o||c(t,u,l)[0]}),[o,l]);return t.createElement(r.Provider,{value:s},t.createElement(a,i({urqlClient:s},f)))};return l.displayName="withUrqlClient("+((o=a).displayName||o.name||"Component")+")",l.getInitialProps=function(r){function o(){return i({},g,{urqlState:q?q.extractData():void 0})}function l(){if("undefined"!=typeof window)return i({},g,{urqlClient:d});var e=i({},g,{urqlClient:d});return Promise.resolve(n(t.createElement(s,i({},p?e:{pageProps:e})))).then(o)}function f(e){g=e}try{var s=r.AppTree,p=!!r.Component,h=p?r.ctx:r,v=c("function"==typeof e?e(h):e,u),d=v[0],q=v[1];d&&(h.urqlClient=d);var g={};const t=function(){if(a.getInitialProps)return Promise.resolve(a.getInitialProps(r)).then(f)}();return Promise.resolve(t&&t.then?t.then(l):l())}catch(e){return Promise.reject(e)}},l}}; | ||
//# sourceMappingURL=next-urql.cjs.min.js.map |
@@ -0,5 +1,6 @@ | ||
import { GraphQLError } from 'graphql'; | ||
import { NextPageContext } from 'next'; | ||
import { ClientOptions, Exchange, Client } from 'urql'; | ||
import { AppContext } from 'next/app'; | ||
export declare type NextUrqlClientOptions = Omit<ClientOptions, 'exchanges' | 'suspense'>; | ||
export declare type NextUrqlClientOptions = Omit<ClientOptions, 'exchanges'>; | ||
export declare type NextUrqlClientConfig = NextUrqlClientOptions | ((ctx?: NextPageContext) => NextUrqlClientOptions); | ||
@@ -26,4 +27,4 @@ export declare type MergeExchanges = (ssrExchange: SSRExchange) => Exchange[]; | ||
error?: { | ||
graphQLErrors: Array<Partial<GraphQLError> | string>; | ||
networkError?: string; | ||
graphQLErrors: string[]; | ||
}; | ||
@@ -30,0 +31,0 @@ } |
{ | ||
"name": "next-urql", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Convenience wrappers for using urql with NextJS.", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
59706
315
0