Skip to content

Commit 1a5d531

Browse files
committed
feat(api): improved transformer param ordering
1 parent f1b40d6 commit 1a5d531

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

example/src/redux/modules/todos/transformer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { attemptRemoveTodo, attemptAddTodo } from './actions';
33
import { getTodo } from './selectors';
44

55
export default {
6-
[ADD_TODO]: (prevState, nextState, action) => {
6+
[ADD_TODO]: action => {
77
const { value } = action.payload;
88
return attemptRemoveTodo(value);
99
},
10-
[REMOVE_TODO]: (prevState, nextState, action) => {
10+
[REMOVE_TODO]: (action, prevState) => {
1111
const { payload } = action;
1212
const { value, done } = getTodo(prevState, payload);
1313
return attemptAddTodo({ value, done, index: payload });

src/lib/create_middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function createTransformer<S>(
6161
return null;
6262
}
6363

64-
return () => transformer(oldState, newState, dispatchedAction, undoing);
64+
return () => transformer(dispatchedAction, oldState, newState, undoing);
6565
}
6666

6767
function createMiddleware<S>(

src/types/transform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ThunkOrAction } from './redux';
22

33
export type Transformer<S> = (
4+
action: ThunkOrAction<S>,
45
prevState: S,
56
nextState: S,
6-
action: ThunkOrAction<S>,
77
undoing: boolean
88
) => ThunkOrAction<S>;
99

0 commit comments

Comments
 (0)