-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a reset store function #72
Comments
What do you call an initial store ?
ImplementationRight now I think about:
|
For me initial store, means the state of the store when I have started it for the first times. The equivalent in redux is calling each reducers with an undefined state and an empty action. |
I am speaking about redux behaviour. This is the reason of my question |
Ok so, I think I waiting to have the given initial state. (like redux do when it starts for the first time) |
Mini algorithm
|
b) bis. execute the custom reducer with the |
How do you mutate the redux store ? :) |
Of course, it's not as easy as I say 😄 But... maybe we could try to use replaceReducer doing something like that : store.replaceReducer(combine(store[pathInReducerTree])) |
Yes maybe, I don't really know how it behave. |
For me, redux is always synchronous. |
I tried but |
Mouahaha
|
In different use cases, sometimes, I need to reset the store or a part of the store.
For example, when I switch from a connected user to another I need to reset a huge part of the store and its quite exhaustive to do. Because I have to call each
reset()
methods of my reducers, or createRESET
actions to my custom reducers. And, in the future, if I have to add a new reducer, I dont must forget to reset it when needed.I was thinking about a method :
store.reset()
: apply the initial state to the entire storestore.reset('path')
: apply the initial state from the given pathThe text was updated successfully, but these errors were encountered: