How to Reset store in setup syntax OR registerModule
+ unregisterModule
alternative in Pinia?
#1180
Unanswered
Rolanddoda
asked this question in
Help and Questions
Replies: 1 comment 5 replies
-
The store will be reinstantiated if you dispose of it and then call The short answer is there is no reset in setup/composition-api/function store. You have to manually write them yourself and you can keep the You could still create a plugin that adds this method automatically for every exposed ref by calling |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have created many Pinia stores in my app and they work great.
However, now I am adding more pages and I see the need to re-use those Pinia stores.
In order to re-use the stores, I need to clean up their state though. In Vuex I was using
registerModule
andunregisterModule
to achieve having a fresh store.I found
$dispose
but it doesn't work and everything seems reactive after I call it:Beta Was this translation helpful? Give feedback.
All reactions