-
Notifications
You must be signed in to change notification settings - Fork 379
Delete persisted state via Nuxt lifecycle hooks #391
Comments
Same issue with you, however for me I do redirection and before I complete my redirection I reset the vuex state to initial state. I do However upon redirection and successful reset, when clicking the back button to return to the website it still retains the product list previously before redirection. Which has been cleared before redirection and should now be an empty. EDIT: I read the readme of the library and it has an option of |
vuex-persistedstate
version: 3.2.0node
version: 12.16.3npm
(oryarn
) version: 6.14.10Relevant code or config
In
nuxt.js
, I'm trying to delete the data in my cart when arriving to the confirmation page.index.js
/pages/confirmation/index.vue
What you did:
I wrote a method
deleteCart
that commits a mutation in order to reset thecart
state. Then usedmounted
nuxt lifecycle hook to fire the method.What happened:
If no setTimeout is used, the method works, but
persistedState
acts after that and overwrites with the previous state. Just usingsetTimeout
I am able to reset the state afterpersitedState
.Problem description:
It is not very cosistent to use a timeout.
Suggested solution:
Is there any event I could use in order to know that
persistedState
has done its job and then reset the state? Any solution is welcome. Thanks in advance!The text was updated successfully, but these errors were encountered: