import { cloneElement, Component, PropTypes } from 'react';
import reducer from './reducers';

export default class FilterMonitor extends Component {
  static update = reducer;

  static propTypes = {
    children: PropTypes.element,
    whitelist: PropTypes.array,
    blacklist: PropTypes.array
  };

  isFiltered(action) {
    return (
      this.props.whitelist && action.match(this.props.whitelist.join('|')) ||
      this.props.blacklist && !action.match(this.props.blacklist.join('|'))
    );
  }

  render() {
    const {
        whitelist, blacklist, monitorState, children,
        stagedActionIds, computedStates,
        ...rest
      } = this.props;
    const filteredStagedActionIds = [];
    const filteredComputedStates = [];

    if (whitelist || blacklist) {
      stagedActionIds.forEach((id, idx) => {
        if (this.isFiltered(rest.actionsById[id].action.type)) {
          filteredStagedActionIds.push(id);
          filteredComputedStates.push(computedStates[idx]);
        }
      });

      rest = {
        ...rest,
        stagedActionIds: filteredStagedActionIds,
        computedStates: filteredComputedStates
      };
    } else {
      rest = {
        ...rest,
        stagedActionIds, computedStates
      };
    }

    const childProps = {
      ...rest,
      monitorState: monitorState.childMonitorState || {}
    };
    return cloneElement(children, childProps);
  }
}

@@ -315,20 +315,57 @@
 d(action
+Type
 ) %7B%0A
+    var type = actionType %7C%7C '';%0A
     retu
@@ -399,22 +399,20 @@
 list && 
-action
+type
 .match(t
@@ -476,22 +476,20 @@
 ist && !
-action
+type
 .match(t

Update FilterMonitor.js