Skip to content

Commit 4ec3a6e

Browse files
author
Xiaohan Zhang
committed
Support Additional arguments for handleAction(s)
* resolve redux-utilities#148
1 parent b0c823c commit 4ec3a6e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/handleAction.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ export default function handleAction(actionType, reducers, defaultState) {
1111
? [reducers, reducers]
1212
: [reducers.next, reducers.throw].map(reducer => (isNil(reducer) ? identity : reducer));
1313

14-
return (state = defaultState, action) => {
14+
return (state = defaultState, action, ...args) => {
1515
if (!includes(actionTypes, action.type.toString())) {
1616
return state;
1717
}
1818

19-
return (action.error === true ? throwReducer : nextReducer)(state, action);
19+
return (
20+
action.error === true ? throwReducer : nextReducer
21+
)(state, action, ...args);
2022
};
2123
}

src/handleActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export default function handleActions(handlers, defaultState) {
66
const reducers = ownKeys(handlers).map(type => handleAction(type, handlers[type]));
77
const reducer = reduceReducers(...reducers);
88

9-
return (state = defaultState, action) => reducer(state, action);
9+
return (state = defaultState, action, ...args) => reducer(state, action, ...args);
1010
}

0 commit comments

Comments
 (0)