title: Reset - Redux throws dispatched an invalid action: undefined
body: <p>I am trying to reset my redux-store on based of logout, but getting following error. Looking for better suggestion to reset my redux-store state so as everywhere I found to set it to undefined will help the case, but in my case it is not working.</p>
  
  <pre><code>    /**
   * Our state is composed of a map of action reducer functions.
   * Here we are going to reset the state of root reducer to undefined to clear data store
   * Logged Action is triggered from User session effects.
   */
  export function resetState(reducer: ActionReducer&lt;State&gt;): ActionReducer&lt;State&gt; {
    return function (state: State, action: UserSessionActions.UserSessionActionsUnion): State {
  
      switch (action.type) {
        case UserSessionActions.UserSessionActionTypes.LoggedOut: {
          state = undefined;
          return reducer(state, action);
        }
        default: {
          return reducer(state, action);
        }
      }
    };
  }
  </code></pre>
  
  <p>but getting this exception</p>
  
  <pre><code>ERROR Error: Effect "UserSessionEffects.logout$" dispatched an invalid action: [object Object]
  at reportInvalidActions (effects.es5.js:236)
  at verifyOutput (effects.es5.js:214)
  at MapSubscriber.project (effects.es5.js:284)
  at MapSubscriber._next (map.js:79)
  at MapSubscriber.Subscriber.next (Subscriber.js:90)
  at SwitchFirstMapSubscriber.notifyNext (exhaustMap.js:113)
  at InnerSubscriber._next (InnerSubscriber.js:23)
  at InnerSubscriber.Subscriber.next (Subscriber.js:90)
  at MapSubscriber._next (map.js:85)
  at MapSubscriber.Subscriber.next (Subscriber.js:90)
  </code></pre>
  
  <p>And here is my effect</p>
  
  <pre><code>    @Effect()
    logout$ = this.actions$.pipe(
      ofType(UserSessionActions.UserSessionActionTypes.LoggedOut),
      map((action: any) =&gt; {
        this.logger.log('logout ' + JSON.stringify(action));
        return Observable.of({});
      }),
      catchError((err) =&gt; {
        this.logger.log(err);
        return Observable.of();
      })
    );
  </code></pre>