Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Local Storage is not initalizing #25

Closed
SmarterPhoneLabs opened this issue May 17, 2017 · 3 comments
Closed

Local Storage is not initalizing #25

SmarterPhoneLabs opened this issue May 17, 2017 · 3 comments

Comments

@SmarterPhoneLabs
Copy link

SmarterPhoneLabs commented May 17, 2017

Hi Robin,
Here is the issue Im having.
I installed the package from npm
I setup my store.ts (yeah Im one of those TypeScript kids)

import * as Vue from 'vue';
import * as Vuex from 'vuex';
import * as createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex);

export const store  = new Vuex.Store({
    state: {
        AppName : "BillAndTedsExcellentApp",
        UserID: 0,
        Crumb: '',
        GPSInsightToken:'',
        HeaderNavItems : [],
        PageOptions : [] 
    },
    plugins: [createPersistedState()]
});

Then when the app recompiles, when I look in the inspector there is nothing for my app listed under LocalStorage.

I tried specifying a key to use my app name instead of your default.

So, it may just be my lack of understanding here, but does it not automatically serialize the items I have listed in my State?

Thanks,
John (YukidamaGame)

@robinvdvleuten
Copy link
Owner

@SmarterPhoneLabs thanks for using the plugin. At first sight nothing is wrong with your setup. Can you confirm that your state is persisted, e.g. can you see the changes you made to the state object in your app upon recompiling?
It could be possible that you bump in - what looks like - an issue with the devtools where localstorage appears to be empty when using hot reloading.

@SmarterPhoneLabs
Copy link
Author

I can confirm that my values are no persisting.
Would be happy to do a screen share or remote session if you would like to see first hand

@SmarterPhoneLabs
Copy link
Author

So I figured the issue out with Robin.
I was not using Mutations on my state, and thus the values were not properly writing.
Once I switched over, all good

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants