Releases: klis87/redux-requests
@redux-requests/core v0.29.1
- fixed
onRequest
which did not work properly for FSA actions (when you haveaction.payload.request
notaction.request
) - removed babel regenerator-runtime from all packages so bundles for some packages are smaller
@redux-requests/core v0.29.0
- added
pristine
flag to queries - you could see it withgetQuery
for instance, it was added to distinguish between situations wheredata
isnull
because no request for a given query was made yet or because truly server response isnull
resetRequests
also resetspristine
totrue
- improved SSR, now you can have mutliple error actions on the server, so for instance you can have 404 error, still render React on the server and error will be passed to the client, it might require
onError
interceptor to adjust how errors are structured, because error has to be serializable in order to pass it to the client
@redux-requests/core v0.28.2
Dispatch of requests actions now rejects promise in case of a syntax error (not related to network issues) not to swallow those errors. Now they should be visible in console.
@redux-requests/promise v0.1.1
A new driver, useful if you connect if an API with a promise based libraries or functions. See https://github.com/klis87/redux-requests/tree/master/packages/redux-requests-promise
@redux-requests/core v0.28.1
Fixed some problems with FSA actions after removing sagas.
@redux-requests/core v0.28.0
As you probably noticed, we just moved to scoped npm packages. Also, we removed redux-saga from dependencies! So you don't have to use redux-saga anymore with this project, albeit it is totally compatible with redux-saga.
What changed:
- the library logic no longer uses sagas, now it is based only on pure promises and redux middleware
- due to migration to scoped packages, you need to replace
redux-saga-requests
with@redux-requests/core
,redux-saga-requests-axios
with@redux-requests/axios
and so on - new promise driver, thx @strdr4605 for the idea and implementation and very clever idea to use AbortController to make it abortable!
- because sagas were removed,
sendRequest
does not exist anymore, but it is not needed, just dispatch request action, and if you need a response, await promise to be resolved, also all interceptor based options etc are handled by action.meta - again, due to removing sagas,
handleRequests
does not returnrequestsSagas
anymore - changed interceptors to be promised based
- added local interceptors, so for instance you can have action.meta.onResponse interceptor only for a specific action
- meta.getData has currentData passed as 2nd argument in case you need it
- pending counter for cached and ssr actions is not updated, which improves performance and prevents ssr flickering
- removed
meta.asPromise
,promisify
andautoPromisify
fromhandleRequests
, because all requests are always promisified, this doesn't hurt, simplifies API and allows you to dispatch actions instead ofsendRequest
without any worry - related to above, no matter what result, whether success, error or abort, dispatching of request actions always returns promise which will be resolved, never rejected, see https://github.com/klis87/redux-requests#promisified-dispatches for usage and justification
- added new
abortRequests
action and at the same time removedonAbort
resetRequests
aborts actions by default, you can change this by passing false as 2nd argument- fixed TS type for
getQuerySelector
andgetMutationSelector
redux-saga-requests v0.27.0
It was a long time since the last release, it was for a reason. This is a very big release,
which is the first step to achieve 1.0 version. It was not splited into smaller releases
not to trouble you constantly with breaking changes plus many things depended on each other.
The easiest way to see what changed is just to quickly read new Readme actually.
But to give you some hints, those are most notable changes:
- removed
watchRequests
,requestsReducer
,networkReducer
, all middleware from public API, it was replaced
byhandleRequests
function which returns all the necessary pieces like reducer, saga, middleware in the right order etc, which simplifies usage, and requires less documentation handleRequests
returnsrequestsReducer
, but this is actually oldnetworkReducer
, oldrequestsReducer
is not supported anymore, in order to support new features it had to be removed, not to mention supporting two different APIs was very bad for maintenance and docs- added automatic but optional data normalisation, similar to GraphQL Apollo but for any API, including REST!
- refactored drivers to simple promises (actually cancellable promises like in Bluebird)
getQuery
andgetMutation
are actually selectors now, not selector creators, selector creators are available as
getQuerySelector
andgetMutationSelector
- query and mutation selectors are memoized per action type and even request key, you don't need to worry about using selectors in multiple places or in components directly anymore, there is just not possible to invalidate cache by accident
- removed
meta.resetOn
, replaced it withresetRequests
action - simplified
meta.getData
andmeta.updateData
payload, see docs or examples for current usage - cache and SSR state is kept in reducer, so usage is simplified and for instance cache is compatible with SSR
- mutations work for cached queries and together with
requestKey
- reducer is pure function now, it doesn't have any internal state, so time travel works now and also
you can use JS closures in meta.getData etc in request actions - removed meta.mutations[TYPE].getRequestKey and replaced it with
meta.requestKey
meta.requestKey
is also possible for queries, so you can store data for query with the same type independentlymeta.cacheKey
was removed, asmeta.requestKey
serves the same purpose, but with or without cache- replaced
meta.cacheSize
withmeta.requestsCapacity
due to the same reason sendRequest
usage is encouraged only in intereceptors, alsodispatchRequestAction
default istrue
- successful response contains only
data
for now, noheaders
orstatus
, usually we care about those
in error responses, possibly this will be updated in the furure, for now it had to be standardized for cache feature
redux-saga-requests-react v0.3.0
See redux-saga-requests v0.27.0
redux-saga-requests-mock v0.2.0
See redux-saga-requests v0.27.0
redux-saga-requests-graphql v0.3.0
See redux-saga-requests v0.27.0