redux-symbiote icon indicating copy to clipboard operation
redux-symbiote copied to clipboard

Store reset

Open tomasz89nowak opened this issue 5 years ago • 3 comments

When user logs out, I want to clear the store with one RESET_STORE action. It's easy to achieve with pure Redux. Is there an elegant way to reset the whole state to initial values with one action, when using redux-symbiote with namespaces?

tomasz89nowak avatar Mar 13 '19 13:03 tomasz89nowak

You can use defaultReducer, to handle your case. I going to think about better API

sergeysova avatar Mar 13 '19 13:03 sergeysova

What about that API:

createSymbiote(initialState, symbiotes, {
  reset: RESET_ACTION,
})

When RESET_ACTION is a global action type.

sergeysova avatar Nov 07 '19 07:11 sergeysova

Actually I don't think it's necessary, I'm pretty satisfied with the "defaultReducer" solution :) A more detailed description in the documentation will be sufficient for me.

tomasz89nowak avatar Nov 29 '19 07:11 tomasz89nowak