From c3d80b422395f1199cd45a9698607d9b8f805124 Mon Sep 17 00:00:00 2001 From: Kai Moseley Date: Sun, 13 Aug 2017 20:41:10 +0100 Subject: [PATCH] Minor readme tweaks --- package-lock.json | 2 +- package.json | 2 +- readme.md | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8eb37e4..c8315a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "redux-scc", - "version": "1.2.1", + "version": "1.2.2", "lockfileVersion": 1, "dependencies": { "abab": { diff --git a/package.json b/package.json index 0abe90e..67a7058 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redux-scc", - "version": "1.2.1", + "version": "1.2.2", "description": "Redux store chunk creator", "main": "./lib/index.js", "scripts": { diff --git a/readme.md b/readme.md index 9a2eedc..c9f9c19 100644 --- a/readme.md +++ b/readme.md @@ -105,17 +105,17 @@ Like all other types, you can also use a custom type to create a reducer. - shift(value: any): Add the value to the beginning of the array. - unshift(): Remove the first element of the array. -#### Batch update +#### Combined actions Automatically generating these actions is a nice time saver, but an issue with them at the moment is that, if you want to update several parts of the store, these actions will need to be dispatched individually. This makes 'time travel' in Redux much more difficult, as the various updates occur individually and cannot easily be rolled back. Additionally, each update will result in redux informing subscribers of -an update! Redux-scc avoids this by providing `batchUpdate`. +an update! Redux-scc avoids this by providing the `createCombinedAction` utility. -batchUpdate takes a name (so you can easily identify the action in the redux dev tools), and an array of redux-scc actions. These +`createCombinedAction` takes a name (so you can easily identify the action in the redux dev tools), and an array of redux-scc actions. These actions will be performed as part of one redux update, thus avoiding the unfortunate side effects mentioned above. ``` -const anExampleBatchUpdate = batchUpdate({ +const anExampleCombinedAction = createCombinedAction({ name: 'an example!', actions: [ actions.someReduxSccReducer.reset(), @@ -129,7 +129,7 @@ If a reducer is affected by the actions multiple times, the actions will play ou ``` //We start with the reducer (which is an array type reducer) having state: [4,5,6] -const exampleBatchedUpdateHittingSameReducerMultipleTimes = batchUpdate({ +const exampleBatchedUpdateHittingSameReducerMultipleTimes = createCombinedAction({ name: 'multiple update funsies!', actions: [ actions.removeAtIndex(1), //removes 5 - [4,6]