title: Redux reducer prevState already set up to newState
body: <p>I am using redux to move search filter through application to components.</p>
  
  <p>I have component where I set up filters and call dispatch function using</p>
  
  <pre><code>this.props.dispatch(setFilter(newFilter));
  </code></pre>
  
  <p>I use sliders / range components to set up values, those components have <em><code>handleAfterChange</code></em>   method which is set up to call mentioned dispatch function. This is working fine.</p>
  
  <p>I have also filters that are set up by clicking buttons, I created <code>onClick</code> handler, and this handler call mentioned function. I checked what I am sending to <code>setFilter</code> functions (newFilter) parameter and it is what I want to set up.</p>
  
  <p>My set action is defined:</p>
  
  <pre><code>export const setFilter = (filter = {}) =&gt; {
      return {
          type: SET_FILTER,
          filter
      };
  };
  </code></pre>
  
  <p>My reducer is:</p>
  
  <pre><code>const searchFilter = (prevState = INITIAL_STATE.filter, action) =&gt; {
      switch (action.type) {
          case SET_FILTER: {
              // prevState is already the state 
              // I want to set up in this reducer
              console.log(prevState);
              return  Object.assign({}, prevState, action.filter);
  
          }
          case RESET_FILTER: {
              return INITIAL_STATE.filter;
          }
          default: {
              return prevState;
          }
      }
  };
  </code></pre>
  
  <p>Problem is that prevState is already the object I want to set up in reducer. 
  I am checking (in another component) if filter has been changed and because of that I get prevProps and nextProps the same so no action will be triggered. </p>
  
  <p>So somehow dispatched changes are already in reducer as prevProps.</p>