Skip to content

@redux-requests/core v0.28.0

Compare
Choose a tag to compare
@klis87 klis87 released this 29 Apr 18:30
· 228 commits to master since this release

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 return requestsSagas 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 and autoPromisify from handleRequests, because all requests are always promisified, this doesn't hurt, simplifies API and allows you to dispatch actions instead of sendRequest 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 removed onAbort
  • resetRequests aborts actions by default, you can change this by passing false as 2nd argument
  • fixed TS type for getQuerySelector and getMutationSelector