diff --git a/README.md b/README.md index 5b5d4a9..6825bfa 100644 --- a/README.md +++ b/README.md @@ -103,13 +103,13 @@ pass a function to `undoable` like this: ```js undoable(reducer, function filterActions(action, currentState, previousState) { - return action.type !== SOME_ACTION; // don't add to history if action isn't SOME_ACTION + return action.type === SOME_ACTION; // only add to history if action is SOME_ACTION }) // or you could do... undoable(reducer, function filterState(action, currentState, previousState) { - return currentState === previousState; // don't add to history if state stayed the same + return currentState !== previousState; // only add to history if state changed }) ``` diff --git a/package.json b/package.json index aed4b8b..c28f4be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redux-undo", - "version": "0.4.0", + "version": "0.4.1", "description": "simple undo/redo functionality for redux state containers", "main": "lib/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index d7a3724..349d226 100644 --- a/src/index.js +++ b/src/index.js @@ -187,7 +187,7 @@ export function parseActions(rawActions = []) { // distinctState helper export function distinctState() { - return (action, currentState, previousState) => currentState === previousState; + return (action, currentState, previousState) => currentState !== previousState; } // /distinctState