-
Notifications
You must be signed in to change notification settings - Fork 6
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 support to reset a store #11
Comments
Thanks for submitting the issue, and I agree that it would be a good feature to have! For the upcoming 0.6 release, I have started adding options to If you're willing to tackle that and submit a PR, go ahead! Otherwise I would probably just take care of it some time over the next couple of weeks, as part of the work to push 0.6 out of the door. |
Now that I check in the sources, maybe it's better to create a different method. I still favour the options object - because it makes it more flexible in the future. However my suggestion is probably not working |
That's fine. I will think about a As an alternative userland workaround/solution, consider writing a function that returns the desired initial state: const initialState = (): YourStateType => ({ foo: "bar", count: 0, stuff: undefined }) And then just using that to update the store using the normal store.set(initialState()) It will not remove properties outside of your type that were added for some reason, of course. |
In certain use-cases I want to reset my store to a certain state
example:
idea:
I'd be willing to create a PR if you think this a feature that should exist in
statery
The text was updated successfully, but these errors were encountered: