Skip to content

Commit

Permalink
0.4.1: document filter behaviour correctly, fix distinctState
Browse files Browse the repository at this point in the history
  • Loading branch information
omnidan committed Sep 24, 2015
1 parent 480f710 commit 3165ef1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3165ef1

Please sign in to comment.