Skip to content

Commit bcf2dbf

Browse files
committed
Filter actions
1 parent e0cec47 commit bcf2dbf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/FilterMonitor.js

+16
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ export default class FilterMonitor extends Component {
1111

1212
render() {
1313
const { whitelist, blacklist, children, ...childProps } = this.props;
14+
15+
if (whitelist || blacklist) {
16+
let { stagedActionIds, actionsById } = childProps;
17+
stagedActionIds = stagedActionIds.filter(id => {
18+
const action = actionsById[id].action;
19+
return (
20+
whitelist && whitelist.indexOf(action.type) !== -1 ||
21+
blacklist && blacklist.indexOf(action.type) === -1
22+
);
23+
});
24+
childProps = {
25+
...childProps,
26+
stagedActionIds: stagedActionIds
27+
};
28+
}
29+
1430
return cloneElement(children, childProps);
1531
}
1632
}

0 commit comments

Comments
 (0)