Skip to content

Releases: lukebrandonfarrell/redux-persist-machine

v3.1.2

04 Jun 09:11
Compare
Choose a tag to compare

3.1.2 (2021-06-04)

Bug Fixes

  • tooling: fixed various issues with release automation (13f065f)

v3.1.1

03 Jun 19:59
Compare
Choose a tag to compare

3.1.1 (2021-06-03)

Bug Fixes

  • tooling: added release automation and pre-commit hooks (ab4f28d)

v3.1.0

09 Dec 18:50
Compare
Choose a tag to compare

The package now exposes a function called getPersistMachineAction, which takes a key to generate the action. This function generates an action name that uses the same standard of the generated name under the hood by the package.

getPersistMachineAction("user.orders") would return @ReduxPM/LoadUserOrders.

Full example:

import { getPersistMachineAction } from 'redux-persist-machine'

case getPersistMachineAction('user.subscriptionOrders'): {
  return {
    ...state,
    ...action.payload,
  };
}

The option to add your own custom action name is, of course, still available.

v3.0.1

09 Dec 05:36
Compare
Choose a tag to compare

The standard for generating action names has been changed. This only applies to the scenarios that a custom action name was not specified.

Before, if we had an reducer called orders, we'd have a generated action name of LOAD_ORDERS. Now, it is @ReduxPM/LoadOrders, as in this manner it's easier to differentiate ordinary actions from the project actions.

v3.0.0

08 Dec 17:27
Compare
Choose a tag to compare
  • persistMiddleware was removed. It is now returned from createPersistMachine
  • It is now necessary to call the persistMiddleware.run() method after setting up the store

This release has breaking changes to the package's API. Some changes were made to facilitate the setup process and make the steps more clear.

Migration guide from 2.0 to 3.0

In this new version, we don't export anymore the persistMiddleware. It is now returned from the createPersistMachine function.

This new version has two major steps to setup the library. First, setup the middleware, then the store, and lastly call the persistMiddleware.run(store) method.

const persistMiddleware = createPersistMachine(structure, saveMethod, loadMethod)
const middleware = [persistMiddleware]

const store = createStore(rootReducer, applyMiddleware(...[middleware]));

// Required step: call this function so we can save the state every time an action is triggered
persistMiddleware.run(store)

In the previous version, we were only passing the save and load function to the persistMiddleware function. This function no longer exists, and now all the arguments (structure, load/save methods, and whether to debug or not) are passed to the createPersistMachine.

And we also have to call persistMiddleware.run(store) so we can attach a listener to the store so it can be triggered every time the state changes.

v2.1.0

30 Nov 18:52
Compare
Choose a tag to compare
  • If nothing is provided to the values property when specifying which fields to keep track of, all fields will be tracked.
  • Added support for automatic loading without having to manually dispatch the action.