0

How do I prevent ngrx store from saving all previous events? I have a USER_WAS_ACTIVE action which resets logout time every time user moves a mouse or something. Naturally I don't want the huge amount of events filling up the memory.

Also I would like to clear the store manually when one user logs out, so the next one cant just open redux devtools and see what the previous user did with the app.

Phil
  • 7,065
  • 8
  • 49
  • 91
  • 1
    The store doesn't store events; it stores state composed from the reducers that process the actions (events). If you want to clear this store on the user logging out, see this answer: http://stackoverflow.com/a/39323601/6680611 – cartant Apr 14 '17 at 07:33

1 Answers1

0

See https://netbasal.com/how-to-secure-your-users-data-after-logout-in-redux-30468c6848e8

const reducers = {
   xxx: xxxReducer
};

export const rootReducer = (state, action) => {
  if (action.type === USER_LOGOUT) {
    state = undefined;
  }

 return combineReducers(reducers)(state, action);
};
Julia Passynkova
  • 17,256
  • 6
  • 33
  • 32