Skip to content

Releases: pburtchaell/redux-promise-middleware

Version 4.4.0

27 Aug 17:23
Compare
Choose a tag to compare

This is a big release that adds new functionality and resolves #159, an outstanding issue from this summer.

Here’s the complete list:

  • Reverts the changes from #126, subsequently released in version 4.3.0.
  • Resolves #159.
  • Adds support for ES6 Modules, thanks to @anajavi. This enables scope hosting on WebPack 3, saving a space and increasing performance.
  • Adds support for custom separators on action types, thanks to @roboslone. Now your actions can be customized to, for example, FOO/FULFILLED or FOO-FULLFILLED instead of FOO_FULFILLED.
  • Updates to WebPack 2, thanks to @GeKorm.
  • Changes UMD paths to dist/umd/redux-promise-middleware.js and dist/umd/redux-promise-middleware.min.js.

Version 4.3.0

15 May 15:25
Compare
Choose a tag to compare

This release has been deprecated due to breaking changes in error handling.

This release fixes a bug when a dispatch call throws an error in handleFulfill, changing the promise state to rejected. This can happen when a reducer throws an error or a component's render throws as a result of a Redux store update.

Thanks to @danwang for the PR!

Version 4.2.1

15 May 15:06
Compare
Choose a tag to compare

This release adds the default suffix types as module exports, as documented in the Introduction. This is useful for reducers.

import { PENDING, FULFILLED, REJECTED } from 'redux-promise-middleware';

export default function fooReducer(state = {}, action) {
  switch (action.type) {
    case `FOO_${FULFILLED}`:
      return ...
  }
}

Thanks to @piu130 for the PR!

Version 4.2.0

29 Nov 16:37
Compare
Choose a tag to compare

Falsy values of the data and meta properties are now preserved by the middleware.

Version 4.1.0

08 Oct 16:03
Compare
Choose a tag to compare

When a Promise is resolved with a value of 0 or false, it will be included as the value of the fulfilled action payload property.

Version 4.0.0

22 Aug 00:41
Compare
Choose a tag to compare

This release introduces changes to error handling.

Previously, the parameter of the rejected promise callback was both the dispatched action and an Error object. The middleware also always constructed a new Error object, which caused unexpected mutation and circular references.

Now, the parameter of the rejected promise callback is the value of reject. The middleware does not construct a new error; it is your responsibility to make sure the promise is rejected with an Error object.

// before
const bar = () => ({
  type: 'FOO',
  payload: new Promise(() => {
    reject('foo');
  })
});.then(() => null, ({ reason, action }) => {
  console.log(action.type): // => 'FOO'
  console.log(reason.message); // => 'foo'
});

// after
const bar = () => ({
  type: 'FOO',
  payload: new Promise(() => {

    /**
     * Make sure the promise is rejected with an error. You
     * can also use `reject(new Error('foo'));`. It's a best
     * practice to reject a promise with an Error object.
     */
    throw new Error('foo');
  })
});.then(() => null, error => {
  console.log(error instanceof Error); // => true
  console.log(error.message); // => 'foo'
});

Version 3.3.2

06 Jul 00:45
Compare
Choose a tag to compare

This release adds UMD (Universal Module Definition) build tasks. A UMD module is a "universal" module compatible either the AMD or CommonJS loaders, or no module loader at all. This blog post offers a comparison between the module types.

The implementation is adapted from reactjs/react-router-redux@ad0d41d and uses a modified module definition to work around webpack/webpack#706. Specifically, this release uses the umd libraryTarget webpack option to "export to AMD, CommonJS2 or as property in root".

Version 3.3.1

05 Jul 15:41
Compare
Choose a tag to compare

This release extends the functionality introduced in version 3.2.0 to preserve the original error. When the rejection reason instance of Error, the original error object will be used instead of constructing a new error.

Version 3.3.0

29 Jun 06:20
Compare
Choose a tag to compare

🔥🚒 The version 3.2.0 release broke catch() on promises.

// expected functionality
doSomethingAsyncAndReject().catch(() => { 
  // called once 🙂
});

// version 3.2.0
doSomethingAsyncAndReject().catch(() => { 
  // never called ☹️
});

This release fixes the functionality of catch and updates tests. Previously, an error in how async...await was used caused tests to pass even if the assertion failed. Tests now use done to ensure async tests complete with full confidence.

Version 3.2.0

27 Jun 01:05
Compare
Choose a tag to compare

Instead of constructing a new promise and returning the new promise, the middleware returns the original promise. This change was made to avoid an anti-pattern and to ensure the original promise object methods are preserved, such as in the case where a library like Bluebird is used.