graphql-react
Advanced tools
Comparing version 8.0.0 to 8.0.1
# graphql-react changelog | ||
## 8.0.1 | ||
### Patch | ||
- Updated dev dependencies. | ||
- `useGraphQL` React hook bug fixes for when arguments change after the initial render: | ||
- Changes that cause the `cacheKey` to change trigger a reload if the `loadOnMount` option is `true`, fixing [#23](https://github.com/jaydenseric/graphql-react/issues/23). | ||
- Fixed stale operation status properties being returned. | ||
- Use [`react-test-renderer`](https://npm.im/react-test-renderer) to test `useGraphQL` with a lot more detail. | ||
- Capitalized the `React` namespace in `useGraphQL`. | ||
- Improved `hashObject()` tests. | ||
## 8.0.0 | ||
@@ -7,3 +19,3 @@ | ||
- Updated the `react` and `react-dom` peer dependencies to `^16.8.0`. | ||
- Updated the [`react`](https://npm.im/react) and [`react-dom`](https://npm.im/react-dom) peer dependencies to `^16.8.0`. | ||
- Removed the `Query` component. | ||
@@ -10,0 +22,0 @@ - No longer exporting `Provider` and `Consumer`; now `GraphQLContext` is exported. |
{ | ||
"name": "graphql-react", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"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.", | ||
@@ -51,4 +51,4 @@ "license": "MIT", | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.2.2", | ||
"@babel/plugin-proposal-class-properties": "^7.3.0", | ||
"@babel/core": "^7.3.3", | ||
"@babel/plugin-proposal-class-properties": "^7.3.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.3.2", | ||
@@ -61,3 +61,3 @@ "@babel/plugin-transform-runtime": "^7.2.0", | ||
"cross-fetch": "^3.0.1", | ||
"eslint": "^5.13.0", | ||
"eslint": "^5.14.1", | ||
"eslint-config-env": "^3.0.0", | ||
@@ -71,3 +71,3 @@ "eslint-config-prettier": "^4.0.0", | ||
"eslint-plugin-react-hooks": "^1.0.2", | ||
"formdata-node": "^1.4.0", | ||
"formdata-node": "^1.4.1", | ||
"graphql": "^14.1.1", | ||
@@ -83,4 +83,5 @@ "graphql-api-koa": "^2.0.0", | ||
"react-dom": "^16.8.2", | ||
"react-test-renderer": "^16.8.2", | ||
"size-limit": "^0.21.1", | ||
"tap": "^12.5.2" | ||
"tap": "^12.5.3" | ||
}, | ||
@@ -87,0 +88,0 @@ "scripts": { |
@@ -36,17 +36,24 @@ 'use strict' | ||
if (fetchOptionsOverride) fetchOptionsOverride(fetchOptions) | ||
var fetchOptionsHash = (0, _hashObject.hashObject)(fetchOptions) | ||
var _react$useState = _react.default.useState( | ||
(0, _hashObject.hashObject)(fetchOptions) | ||
var _React$useState = _react.default.useState(fetchOptionsHash), | ||
cacheKey = _React$useState[0], | ||
setCacheKey = _React$useState[1] | ||
var _React$useState2 = _react.default.useState(graphql.cache[cacheKey]), | ||
cacheValue = _React$useState2[0], | ||
setCacheValue = _React$useState2[1] | ||
var _React$useState3 = _react.default.useState( | ||
cacheKey in graphql.operations || loadOnMount | ||
), | ||
cacheKey = _react$useState[0], | ||
setCacheKey = _react$useState[1] | ||
loading = _React$useState3[0], | ||
setLoading = _React$useState3[1] | ||
var _react$useState2 = _react.default.useState(graphql.cache[cacheKey]), | ||
cacheValue = _react$useState2[0], | ||
setCacheValue = _react$useState2[1] | ||
if (cacheKey !== fetchOptionsHash) { | ||
setCacheKey((cacheKey = fetchOptionsHash)) | ||
setCacheValue((cacheValue = graphql.cache[cacheKey])) | ||
setLoading((loading = cacheKey in graphql.operations || loadOnMount)) | ||
} | ||
var _react$useState3 = _react.default.useState(loadOnMount), | ||
loading = _react$useState3[0], | ||
setLoading = _react$useState3[1] | ||
var operate = function operate() { | ||
@@ -98,3 +105,2 @@ return graphql.operate({ | ||
graphql.on('reset', onReset) | ||
if (loadOnMount) load() | ||
return function() { | ||
@@ -107,2 +113,9 @@ graphql.off('fetch', onFetch) | ||
_react.default.useEffect( | ||
function() { | ||
if (loadOnMount) load() | ||
}, | ||
[cacheKey] | ||
) | ||
if (graphql.ssr && loadOnMount && !cacheValue) operate() | ||
@@ -109,0 +122,0 @@ return { |
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
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
79101
706
4
33