redux-requests

Declarative AJAX requests and automatic network state management for single-page applications

MIT License

Downloads
24.1K
Stars
367
Committers
15

Bot releases are visible (Hide)

redux-requests - redux-saga-requests-fetch v0.6.1

Published by klis87 over 6 years ago

Reduced bundle size thanks to upgrade to Webpack 4 (only for UMD build).

redux-requests - redux-saga-requests-axios v0.6.1

Published by klis87 over 6 years ago

Reduced bundle size thanks to upgrade to Webpack 4 (only for UMD build).

redux-requests - redux-saga-requests v0.12.1

Published by klis87 over 6 years ago

Fixed bug when using Axios driver with FSA actions - error action was incorrectly interpret as a request, because request key in error actions in payload was set by Axios, which collided with request key from this library. Details can be seen in #101. Great thanks to @qizmaster for fixing this!

redux-requests - redux-saga-requests v0.12.0

Published by klis87 over 6 years ago

Added an optional requestsPromiseMiddleware, which promisifies request actions so you can wait for them to resolve from React components - see README for more info.

Apart from this:

  • BREAKING - standardized request action structure - previously it was { type: 'A_TYPE', request: {} } or { type: 'A_TYPE', requests: [{}, {}] }, now batched request also go into request key - { type: 'A_TYPE', request: [{}, {}] }
  • fixed UMD bundle - removed redux-saga from the bundle, which was there due to Webpack misconfiguration
redux-requests - redux-saga-requests v0.11.0

Published by klis87 over 6 years ago

This is quite an important release, focusing on making watchRequests configurable. Before, watchRequests wasn't flexible and powerful enough to support requests aborts, so lower level sendRequest was necessery then. From now on, watchRequests should be enough to handle aborts as well, so everyone can switch to auto mode with watchRequests, which will greatly simplify sagas. See updated docs for more details.

Apart from this, following updates were made:

  • allowed passing redux-act and redux-actions actions list to requestsReducer resetOn
  • now resetHandler in requestsReducer doesn't touch pending counter - before subtle counter bugs could happen during requests aborts
  • fixed error payload in error actions - wrong error object was passed
redux-requests - redux-saga-requests v0.10.0

Published by klis87 over 6 years ago

Added resetOn to requestsReducer config. Useful to reset state in your reducers easily. One nice possibility is to create your own requestsReducer with a global behaviour, for example:

const myRequestsReducer = createRequestsReducer({ resetOn: ['LOGOUT'] });
// or const myRequestsReducer = createRequestsReducer({ resetOn: action => action.type === 'LOGOUT' });

Now, with 1 line of code, all your requests reducers will restart their state to initial one on user logout.
Of course, you can pass resetOn to each requestsReducer independently, which will overwrite global resetOn (if defined).

redux-requests - redux-saga-requests v0.9.0

Published by klis87 over 6 years ago

Additional interceptor updates:

  • BREAKING: silent flag in sendRequest only stops actions from being dispatched, it doesn't affect interceptors

  • added runOnRequest, runOnSuccess, runOnError and runOnAbort flags to sendRequest to control whether an interceptor should be called, all default to true, useful to prevent endless loops when calling sendRequest inside an interceptor

  • BREAKING: changed return type of onError interceptor to match type of sendRequest, now you must return { response: someResponse } or { error: someError }, this change was made to allow shortcut like this:

    function* onErrorSaga(error, action) {
      if (weCanTryToRetry(error)) {
        return yield call(sendRequest, action, { silent: true, runOnError: false });
      }
    
      return { error }
    }
    
redux-requests - redux-saga-requests v0.8.0

Published by klis87 over 6 years ago

  • improved interceptors:

    • passed request action to all interceptors as last argument
    • BREAKING: you have to return something in onRequest, onResponse and onError interceptors, for example request config with added header in onRequest, see interceptors in new docs
  • BREAKING: in order to mark dispatchRequestAction as true in sendRequest, you need to:

    yield call(
      sendRequest,
      action,
      { dispatchRequestAction: true },
    );
    

    instead of

    yield call(sendRequest, action, true);
    
  • new flag silent which you can pass in config to sendRequest (like dispatchRequestAction), it tells sendRequest not to dispatch any action and not to call any interceptor, false as a default, useful inside interceptors

redux-requests - redux-saga-requests v0.7.0

Published by klis87 over 6 years ago

  • added successAction, errorAction and abortAction to createRequestsInstance config to allow actions customization
  • BREAKING - renamed getSuccessAction, getErrorAction, getAbortAction to success, error, abort in requestsReducer for consistency
  • added requestsReducer config to its getData and getError
  • added "sideEffects": false to package.json for Webpack 4 tree-shaking
redux-requests - redux-saga-requests v0.6.0

Published by klis87 over 6 years ago

From this version this mono repo switches to independend Lerna mode - this means that when 2 packages are updated at the same time, they could be updated to a different version.

Regarding updates for redux-saga-requests package:

  • POTENTIALLY BREAKING: changed the way success, error, abort actions are structured, see actions and FSA in readme
  • added getError option to requestsReducer
  • added Actions and FSA blocks to readme
redux-requests - redux-saga-requests-axios v0.6.0

Published by klis87 over 6 years ago

The same as v0.5.0, version bumped to switch to independend Lerna mode.

redux-requests - redux-saga-requests-fetch v0.6.0

Published by klis87 over 6 years ago

The same as v0.5.0, version bumped to switch to independend Lerna mode.

redux-requests - v0.5.0

Published by klis87 almost 7 years ago

  • added requestsReducer and createRequestsReducer
  • improved TypeScript typings
redux-requests - v0.4.1

Published by klis87 almost 7 years ago

Updated dependencies and peer-dependencies. You can safely upgrade without any application changes.

redux-requests - v0.4.0

Published by klis87 almost 7 years ago

From this release this library switched to monorepo structure. It means, that redux-saga-requests contains only the core functionality, and a client integration code like Axios or Fetch API were moved to dedicated packages:

  • redux-saga-requests-axios
  • redux-saga-requests-fetch

This gives a nice advantage that from now, you will have only a specific driver you use bundled with you application, saving precious bytes. So, to switch to this version, you will need to install not only redux-saga-requests, but also a driver of your choice. Please see updated docs to see how it should be done.

redux-requests - v0.3.0

Published by klis87 almost 7 years ago

Added Typescript types

redux-requests - v0.2.0

Published by klis87 about 7 years ago

Initial release