Releases: klis87/redux-requests
redux-saga-requests-fetch v0.9.0
Internal refactoring, see more info in redux-saga-requests v0.16.0 release.
redux-saga-requests-axios v0.7.0
Internal refactoring, see more info in redux-saga-requests v0.16.0 release.
redux-saga-requests-fetch v0.8.0
Added an optional AbortController
support, so fetch request can be trully aborted - previously aborts were just ignored and only abort action was dispatched.
To use it, just pass AbortController
class to createRequestInstance
, like:
yield createRequestInstance(
window.fetch,
{
driver: fetchDriver,
baseURL: 'https://my-domain.com',
AbortController: window.AbortController, // or a ponyfill
},
);
redux-saga-requests-fetch v0.7.0
Now streams are automatically read and saved as response.data
, so you never need to use response
methods like response.json()
, response.blob()
etc. This is also done for error instances.
Also, added responseType
null
option, which is useful for responses with no body, like with 204
status code, for which response.json()
would fail, or when you don't care about a response body - then it could you some milliseconds as a json parse won't be done in vain. For example:
const fetchEmptyBody = () => ({
type: 'FETCH_EMPTY_BODY',
request: {
url: '/endpoint',
responseType: null,
},
});
redux-saga-requests v0.15.0
Added possibility to define takeLatest
in watchRequest
as function action => boolean
.
Also (BREAKING
), above enhancement has been used to change takeLatest
default - before it was set to true
for all requests, now it depends on request's method - GET
requests use takeLatest
true
, the rest ones use takeLatest
false
. Usually this is what you need. Most often you are only interested in the latest response of read only GET
requests. However, for side effect requests, like POST
, for example when adding a new comment, you will need to react to all new comment responses, otherwise you could miss some updates. If you don't like it, you can always provide your own takeLatest
implementation in watchRequests
config.
redux-saga-requests v0.14.0
BREAKING
- requestsPromiseMiddleware
doesn't promisify all requests actions automatically anymore. Now you have to add meta.asPromise
to request actions, for example:
const requestAction = {
type: 'FETCH_STH',
request: { url: '/sth' },
meta: { asPromise: true },
};
If you with to revert to previous behaviour, pass auto: true
to requestsPromiseMiddleware
:
requestsPromiseMiddleware({ auto: true });
Big thanks to @mowbell for the idea.
redux-saga-requests v0.13.2
Fixed a crash when an action had a structure { type: 'TYPE': payload: null }
, thanks to @EvgeneOskin!
redux-saga-requests v0.13.1
Fixed bug when using Axios driver - action with request error was incorrectly interpret as a request. There was a similar issue #101 already solved, but it exluded response errors, it didn't consider potential request error, due to lack of internet connection for instance. Details can be seen in #133. Big thanks to @nemosupremo for spotting and fixing this issue!
redux-saga-requests v0.13.0
A small change of default onRequest
handler in requestsReducer
- it doesn't touch data
anymore, it only resets error
and updates pending
counter.
redux-saga-requests v0.12.2
Reduced bundle size thanks to upgrade to Webpack 4 (only for UMD build).