Just curiosity #65
Comments
@AAhrit The recommended way is to go full-in on the Vuex API where possible. If you're going to mutate the localStorage instance from outside Vuex, you'll end up with some pretty nifty side effects. |
@AAhrit So the answer your second answer, I only interact with localStorage from within the plugin. When I need to access any "persisted state" I use the getters from the Vuex. |
Oh I see, but how you change the state from within the plugin in every refresh? There is a function called |
@AAhrit depends on what you want to do with your plugin. I use |
When you say whenever you need to access to any "persisted state" you use Vuex getters, but this is when the state changes and you need to store whatever was changed? I mean you kept track any changes by watching the state through getters? |
I get the state changes by subscribing my plugin to Vuex |
subscribing you mean adding the plugin to the |
Yes indeed, exactly as described in the docs. |
So, every time the state changes you grab it using getters then you store it, again, again and again |
I'm sorry if I sound repetitive but when you access to the state you do something like this: I'm guessing that if I put inside the Lastly if I don't write down what I want to persist how you from within the plugin persist everything? I mean what is your code aproach. |
@AAhrit I will close this issue for now. I do not really get what you're trying to solve here. If you like to know how the plugin works try to look at the code, those hundred or so lines aren't that hard to understand. |
When the plugin is using the localStorage and a refresh happends internally it is just commiting a mutation to kept in sync with the store and if I declare a mutation that mutate the state this is pick up by the plugin, if so what is the best way of doing it? I am making my own for more specific needs and I will appreciate your tips and answer.
Are you changing the state directly from within the plugin?
By the way awesome plugin...
The text was updated successfully, but these errors were encountered: