graphql-react
Advanced tools
Comparing version 8.2.0 to 8.3.0
# graphql-react changelog | ||
## 8.3.0 | ||
### Minor | ||
- Added a `response` property to the `GraphQL` instance `cache` event payload, containing the original `fetch` [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) instance the `cacheValue` was derived from. | ||
### Patch | ||
- Updated dependencies. | ||
- Increased the post SSR hydration time from 500 to 1000 milliseconds, closing [#37](https://github.com/jaydenseric/graphql-react/issues/37). | ||
- Added a `useGraphQL` options guide for common situations. | ||
- Test `GraphQL.operate()` with both `reloadOnLoad` and `resetOnLoad` options true. | ||
- Use string `FormData` field names, as some `FormData` polyfills don't coerce numbers like native implementations do. | ||
- Test files in variables result in appropriate fetch options for a valid [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). | ||
- Tidied test names. | ||
- Nicer Browserslist syntax for supported Node.js versions. | ||
## 8.2.0 | ||
@@ -4,0 +21,0 @@ |
{ | ||
"name": "graphql-react", | ||
"version": "8.2.0", | ||
"version": "8.3.0", | ||
"description": "A lightweight but powerful GraphQL client for React using modern context and hooks APIs; the first Relay and Apollo alternative with server side rendering.", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
}, | ||
"browserslist": "> 0.5%, not dead, node 8.5", | ||
"browserslist": "> 0.5%, not dead, node >= 8.5", | ||
"peerDependencies": { | ||
@@ -44,3 +44,3 @@ "react": "^16.8.0", | ||
"dependencies": { | ||
"@babel/runtime": "^7.4.3", | ||
"@babel/runtime": "^7.5.4", | ||
"extract-files": "^5.0.1", | ||
@@ -53,35 +53,36 @@ "fnv1a": "^1.0.1", | ||
"devDependencies": { | ||
"@babel/cli": "^7.4.3", | ||
"@babel/core": "^7.4.3", | ||
"@babel/plugin-proposal-class-properties": "^7.4.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.4.3", | ||
"@babel/plugin-transform-runtime": "^7.4.3", | ||
"@babel/preset-env": "^7.4.3", | ||
"@babel/cli": "^7.5.0", | ||
"@babel/core": "^7.5.4", | ||
"@babel/plugin-proposal-class-properties": "^7.5.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.5.4", | ||
"@babel/plugin-transform-runtime": "^7.5.0", | ||
"@babel/preset-env": "^7.5.4", | ||
"@babel/preset-react": "^7.0.0", | ||
"babel-eslint": "^10.0.1", | ||
"babel-eslint": "^10.0.2", | ||
"babel-plugin-transform-replace-object-assign": "^2.0.0", | ||
"cross-fetch": "^3.0.2", | ||
"eslint": "^5.16.0", | ||
"eslint-config-env": "^4.0.0", | ||
"eslint-config-prettier": "^4.1.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"cross-fetch": "^3.0.4", | ||
"eslint": "^6.0.1", | ||
"eslint-config-env": "^8.0.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-import": "^2.18.0", | ||
"eslint-plugin-import-order-alphabetical": "^0.0.2", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"eslint-plugin-react-hooks": "^1.6.0", | ||
"formdata-node": "^1.5.2", | ||
"graphql": "^14.2.1", | ||
"eslint-plugin-jsdoc": "^15.5.1", | ||
"eslint-plugin-node": "^9.1.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"eslint-plugin-react": "^7.14.2", | ||
"eslint-plugin-react-hooks": "^1.6.1", | ||
"formdata-node": "^1.8.0", | ||
"graphql": "^14.4.2", | ||
"graphql-api-koa": "^2.0.0", | ||
"husky": "^1.3.1", | ||
"jsdoc-md": "^2.1.0", | ||
"husky": "^3.0.0", | ||
"jsdoc-md": "^3.0.0", | ||
"koa": "^2.7.0", | ||
"koa-bodyparser": "^4.2.1", | ||
"lint-staged": "^8.1.5", | ||
"prettier": "^1.17.0", | ||
"lint-staged": "^9.2.0", | ||
"prettier": "^1.18.2", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"react-test-renderer": "^16.8.6", | ||
"size-limit": "^1.0.1", | ||
"tap": "^12.6.1" | ||
"size-limit": "^1.3.7", | ||
"tap": "^14.4.1" | ||
}, | ||
@@ -88,0 +89,0 @@ "scripts": { |
@@ -257,3 +257,3 @@ ![graphql-react logo](https://cdn.jsdelivr.net/gh/jaydenseric/graphql-react@0.1.0/graphql-react-logo.svg) | ||
| :-- | :-- | :-- | | ||
| `options` | Object? = `{}` | Options. | | ||
| `options` | object? = `{}` | Options. | | ||
| `options.cache` | [GraphQLCache](#type-graphqlcache)? = `{}` | Cache to import; usually from a server side render. | | ||
@@ -281,4 +281,4 @@ | ||
| :-------- | :------- | :------------- | | ||
| `type` | String | Event type. | | ||
| `handler` | function | Event handler. | | ||
| `type` | string | Event type. | | ||
| `handler` | Function | Event handler. | | ||
@@ -291,4 +291,4 @@ #### GraphQL instance method on | ||
| :-------- | :------- | :------------- | | ||
| `type` | String | Event type. | | ||
| `handler` | function | Event handler. | | ||
| `type` | string | Event type. | | ||
| `handler` | Function | Event handler. | | ||
@@ -305,3 +305,3 @@ ##### See | ||
| :-- | :-- | :-- | | ||
| `options` | Object | Options. | | ||
| `options` | object | Options. | | ||
| `options.operation` | [GraphQLOperation](#type-graphqloperation) | GraphQL operation. | | ||
@@ -378,3 +378,3 @@ | `options.fetchOptionsOverride` | [GraphQLFetchOptionsOverride](#type-graphqlfetchoptionsoverride)? | Overrides default GraphQL operation [`fetch` options](#type-graphqlfetchoptions). | | ||
**Type:** Object<[GraphQLCacheKey](#type-graphqlcachekey), Promise<[GraphQLCacheValue](#type-graphqlcachevalue)>> | ||
**Type:** object<[GraphQLCacheKey](#type-graphqlcachekey), Promise<[GraphQLCacheValue](#type-graphqlcachevalue)>> | ||
@@ -389,3 +389,3 @@ --- | ||
| :-- | :-- | :-- | | ||
| `props` | Object | Component props. | | ||
| `props` | object | Component props. | | ||
| `props.graphql` | [GraphQL](#class-graphql) | [`GraphQL`](#class-graphql) instance. | | ||
@@ -423,3 +423,3 @@ | `props.children` | [ReactNode](#type-reactnode)? | React children. | | ||
| :-- | :-- | :-- | | ||
| `data` | Object | [`GraphQL`](#class-graphql) `cache` event data. | | ||
| `data` | object | [`GraphQL`](#class-graphql) `cache` event data. | | ||
| `data.cacheKey` | [GraphQLCacheKey](#type-graphqlcachekey) | [GraphQL cache](#graphql-instance-property-cache) [key](#type-graphqlcachekey). | | ||
@@ -451,3 +451,3 @@ | `data.cacheValue` | [GraphQLCacheKey](#type-graphqlcachekey) | [GraphQL cache](#graphql-instance-property-cache) [value](#type-graphqlcachevalue). | | ||
| `node` | [ReactNode](#type-reactnode) | React virtual DOM node. | | ||
| `render` | function? = `ReactDOMServer.renderToStaticMarkup` | Synchronous React server side render function, defaulting to [`ReactDOMServer.renderToStaticMarkup`](https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup) as it is more efficient than [`ReactDOMServer.renderToString`](https://reactjs.org/docs/react-dom-server.html#rendertostring). | | ||
| `render` | Function? = `ReactDOMServer.renderToStaticMarkup` | Synchronous React server side render function, defaulting to [`ReactDOMServer.renderToStaticMarkup`](https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup) as it is more efficient than [`ReactDOMServer.renderToString`](https://reactjs.org/docs/react-dom-server.html#rendertostring). | | ||
@@ -510,3 +510,3 @@ **Returns:** Promise<string> — Promise resolving the rendered HTML string. | ||
| :-- | :-- | :-- | | ||
| `options` | Object | Options. | | ||
| `options` | object | Options. | | ||
| `options.fetchOptionsOverride` | [GraphQLFetchOptionsOverride](#type-graphqlfetchoptionsoverride)? | Overrides default [`fetch` options](#type-graphqlfetchoptions) for the GraphQL operation. | | ||
@@ -553,2 +553,15 @@ | `options.loadOnMount` | boolean? = `true` | Should the operation load when the component mounts. | | ||
_Options guide for common situations._ | ||
> The defaults are suitable for typical query use, as apps tend to have more queries than mutations. | ||
> | ||
> | Situation | `loadOnMount` | `loadOnReload` | `loadOnReset` | `reloadOnLoad` | `resetOnLoad` | | ||
> | :-- | :-: | :-: | :-: | :-: | :-: | | ||
> | Profile query | ✔️ | ✔️ | ✔️ | | | | ||
> | Login mutation | | | | | ✔️ | | ||
> | Logout mutation | | | | | ✔️ | | ||
> | Change password mutation | | | | | | | ||
> | Change name mutation | | | | ✔️ | | | ||
> | Like a post mutation | | | | ✔️ | | | ||
--- | ||
@@ -560,8 +573,8 @@ | ||
**Type:** Object | ||
**Type:** object | ||
| Property | Type | Description | | ||
| :-- | :-- | :-- | | ||
| `Provider` | function | [React context provider component](https://reactjs.org/docs/context#contextprovider). | | ||
| `Consumer` | function | [React context consumer component](https://reactjs.org/docs/context#contextconsumer). | | ||
| `Provider` | Function | [React context provider component](https://reactjs.org/docs/context#contextprovider). | | ||
| `Consumer` | Function | [React context consumer component](https://reactjs.org/docs/context#contextconsumer). | | ||
@@ -593,3 +606,3 @@ #### See | ||
**Type:** Object<[GraphQLCacheKey](#type-graphqlcachekey), [GraphQLCacheValue](#type-graphqlcachevalue)> | ||
**Type:** object<[GraphQLCacheKey](#type-graphqlcachekey), [GraphQLCacheValue](#type-graphqlcachevalue)> | ||
@@ -615,3 +628,3 @@ #### See | ||
**Type:** Object | ||
**Type:** object | ||
@@ -623,4 +636,4 @@ | Property | Type | Description | | ||
| `parseError` | string? | Parse error message. | | ||
| `graphQLErrors` | Array<Object>? | GraphQL response errors. | | ||
| `data` | Object? | GraphQL response data. | | ||
| `graphQLErrors` | Array<object>? | GraphQL response errors. | | ||
| `data` | object? | GraphQL response data. | | ||
@@ -633,3 +646,3 @@ --- | ||
**Type:** Object | ||
**Type:** object | ||
@@ -640,3 +653,3 @@ | Property | Type | Description | | ||
| `body` | string \| FormData | HTTP request body. | | ||
| `headers` | Object | HTTP request headers. | | ||
| `headers` | object | HTTP request headers. | | ||
| `credentials` | string? | Authentication credentials mode. | | ||
@@ -654,3 +667,3 @@ | ||
**Type:** function | ||
**Type:** Function | ||
@@ -683,3 +696,3 @@ | Parameter | Type | Description | | ||
**Type:** Object | ||
**Type:** object | ||
@@ -689,3 +702,3 @@ | Property | Type | Description | | ||
| `query` | string | GraphQL queries/mutations. | | ||
| `variables` | Object | Variables used in the `query`. | | ||
| `variables` | object | Variables used in the `query`. | | ||
@@ -703,3 +716,3 @@ #### See | ||
**Type:** Object | ||
**Type:** object | ||
@@ -722,7 +735,7 @@ | Property | Type | Description | | ||
**Type:** Object | ||
**Type:** object | ||
| Property | Type | Description | | ||
| :-- | :-- | :-- | | ||
| `load` | function | Loads the GraphQL operation on demand, updating the [GraphQL cache](#graphql-instance-property-cache). | | ||
| `load` | Function | Loads the GraphQL operation on demand, updating the [GraphQL cache](#graphql-instance-property-cache). | | ||
| `loading` | boolean | Is the GraphQL operation loading. | | ||
@@ -742,3 +755,3 @@ | `cacheKey` | [GraphQLCacheKey](#type-graphqlcachekey) | [GraphQL cache](#graphql-instance-property-cache) [key](#type-graphqlcachekey). | | ||
**Type:** Object | ||
**Type:** object | ||
@@ -745,0 +758,0 @@ | Property | Type | Description | |
@@ -49,2 +49,3 @@ 'use strict' | ||
options = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ['url']) | ||
var fetchResponse | ||
var fetcher = | ||
@@ -62,2 +63,3 @@ typeof fetch === 'function' | ||
function(response) { | ||
fetchResponse = response | ||
if (!response.ok) | ||
@@ -93,3 +95,4 @@ cacheValue.httpError = { | ||
cacheKey: cacheKey, | ||
cacheValue: cacheValue | ||
cacheValue: cacheValue, | ||
response: fetchResponse | ||
}) | ||
@@ -96,0 +99,0 @@ |
@@ -34,3 +34,3 @@ 'use strict' | ||
files.forEach(function(paths, file) { | ||
form.append(++i, file, file.name) | ||
form.append('' + ++i, file, file.name) | ||
}) | ||
@@ -37,0 +37,0 @@ fetchOptions.body = form |
@@ -151,3 +151,3 @@ 'use strict' | ||
cacheKey !== loadedOnMountCacheKey && | ||
!(cacheValue && new Date() - firstRenderDate < 500) | ||
!(cacheValue && new Date() - firstRenderDate < 1000) | ||
) { | ||
@@ -154,0 +154,0 @@ setLoadedOnMountCacheKey(cacheKey) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85419
900
748
34
Updated@babel/runtime@^7.5.4