Skip to content

v4.1.0

Compare
Choose a tag to compare
@greena13 greena13 released this 18 Aug 17:13
· 103 commits to master since this release

New features (potentially breaking changes)

Singular resources can now specify params to send to the remote API when performing asynchronous actions, as their first (optional) parameter.

So now if an action creator resulting from a singular resource (as opposed to a resources) definition is called with 1 argument, it is interpreted as the values for the action creator. If it's called with two arguments, they're interpreted as params and values respectively. If 3 are provided, they're interpreted as params, values and action creator options (in that order).

For action creators that do not accept values (such as destroyItem or fetchItems), one argument is interpreted as params, two are processed as params and action creator options, respectively.

Warning: This may be a breaking change if you were using the action creator options for a singular resource action creator. You will need to now explicitly define a params value as the first argument. To replicate the previous behaviour, use the UNSPECIFIED_KEY constant.

Before:

fetchItems({ force: true });

After:

import { UNSPECIFIED_KEY } from 'redux-and-the-rest';

fetchItems(UNSPECIFIED_KEY, { force: true });