axios-hooks
Advanced tools
Comparing version 1.10.1-0 to 1.10.1-1
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.10.1-1](https://github.com/simoneb/axios-hooks/compare/v1.10.1-0...v1.10.1-1) (2020-06-20) | ||
### Bug Fixes | ||
* **250:** more robust cancellation approach ([1a4ff02](https://github.com/simoneb/axios-hooks/commit/1a4ff0280e07615c570556d7143c423b0df6b324)) | ||
### [1.10.1-0](https://github.com/simoneb/axios-hooks/compare/v1.10.0...v1.10.1-0) (2020-06-15) | ||
@@ -7,0 +14,0 @@ |
@@ -265,3 +265,3 @@ "use strict"; | ||
var cancelSourceRef = _react["default"].useRef(); | ||
var cancelSourceRef = _react["default"].useRef(_axios["default"].CancelToken.source()); | ||
@@ -278,3 +278,3 @@ var _React$useReducer = _react["default"].useReducer(reducer, createInitialState(options)), | ||
_react["default"].useLayoutEffect(function () { | ||
_react["default"].useEffect(function () { | ||
cancelSourceRef.current = _axios["default"].CancelToken.source(); | ||
@@ -294,2 +294,4 @@ | ||
var refetch = _react["default"].useCallback(function (configOverride, options) { | ||
cancelSourceRef.current.cancel(); | ||
cancelSourceRef.current = _axios["default"].CancelToken.source(); | ||
return executeRequest((0, _extends3["default"])({ | ||
@@ -296,0 +298,0 @@ cancelToken: cancelSourceRef.current.token |
@@ -244,3 +244,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
}, options); | ||
var cancelSourceRef = React.useRef(); | ||
var cancelSourceRef = React.useRef(StaticAxios.CancelToken.source()); | ||
@@ -257,3 +257,3 @@ var _React$useReducer = React.useReducer(reducer, createInitialState(options)), | ||
React.useLayoutEffect(function () { | ||
React.useEffect(function () { | ||
cancelSourceRef.current = StaticAxios.CancelToken.source(); | ||
@@ -272,2 +272,4 @@ | ||
var refetch = React.useCallback(function (configOverride, options) { | ||
cancelSourceRef.current.cancel(); | ||
cancelSourceRef.current = StaticAxios.CancelToken.source(); | ||
return executeRequest(_extends({ | ||
@@ -274,0 +276,0 @@ cancelToken: cancelSourceRef.current.token |
{ | ||
"name": "axios-hooks", | ||
"version": "1.10.1-0", | ||
"version": "1.10.1-1", | ||
"description": "axios-hooks", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -160,3 +160,3 @@ import React from 'react' | ||
const cancelSourceRef = React.useRef() | ||
const cancelSourceRef = React.useRef(StaticAxios.CancelToken.source()) | ||
@@ -174,3 +174,3 @@ const [state, dispatch] = React.useReducer( | ||
React.useLayoutEffect(() => { | ||
React.useEffect(() => { | ||
cancelSourceRef.current = StaticAxios.CancelToken.source() | ||
@@ -192,2 +192,5 @@ | ||
(configOverride, options) => { | ||
cancelSourceRef.current.cancel() | ||
cancelSourceRef.current = StaticAxios.CancelToken.source() | ||
return executeRequest( | ||
@@ -194,0 +197,0 @@ { |
45192
698