{"action":"created","issue":{"url":"https://api.github.com/repos/championswimmer/vuex-module-decorators/issues/46","repository_url":"https://api.github.com/repos/championswimmer/vuex-module-decorators","labels_url":"https://api.github.com/repos/championswimmer/vuex-module-decorators/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/championswimmer/vuex-module-decorators/issues/46/comments","events_url":"https://api.github.com/repos/championswimmer/vuex-module-decorators/issues/46/events","html_url":"https://github.com/championswimmer/vuex-module-decorators/issues/46","id":374867856,"node_id":"MDU6SXNzdWUzNzQ4Njc4NTY=","number":46,"title":"Values are flushed on page load","user":{"login":"woegjiub","id":2138067,"node_id":"MDQ6VXNlcjIxMzgwNjc=","avatar_url":"https://avatars1.githubusercontent.com/u/2138067?v=4","gravatar_id":"","url":"https://api.github.com/users/woegjiub","html_url":"https://github.com/woegjiub","followers_url":"https://api.github.com/users/woegjiub/followers","following_url":"https://api.github.com/users/woegjiub/following{/other_user}","gists_url":"https://api.github.com/users/woegjiub/gists{/gist_id}","starred_url":"https://api.github.com/users/woegjiub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woegjiub/subscriptions","organizations_url":"https://api.github.com/users/woegjiub/orgs","repos_url":"https://api.github.com/users/woegjiub/repos","events_url":"https://api.github.com/users/woegjiub/events{/privacy}","received_events_url":"https://api.github.com/users/woegjiub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-29T05:52:49Z","updated_at":"2018-10-29T21:13:10Z","closed_at":null,"author_association":"NONE","body":"When using a plugin that stores in local storage, it looks like the class instantiation overwrites the stored values on page load.\r\n\r\nDo you have an example that keeps those values after page reload etc.?"},"comment":{"url":"https://api.github.com/repos/championswimmer/vuex-module-decorators/issues/comments/434082258","html_url":"https://github.com/championswimmer/vuex-module-decorators/issues/46#issuecomment-434082258","issue_url":"https://api.github.com/repos/championswimmer/vuex-module-decorators/issues/46","id":434082258,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDA4MjI1OA==","user":{"login":"woegjiub","id":2138067,"node_id":"MDQ6VXNlcjIxMzgwNjc=","avatar_url":"https://avatars1.githubusercontent.com/u/2138067?v=4","gravatar_id":"","url":"https://api.github.com/users/woegjiub","html_url":"https://github.com/woegjiub","followers_url":"https://api.github.com/users/woegjiub/followers","following_url":"https://api.github.com/users/woegjiub/following{/other_user}","gists_url":"https://api.github.com/users/woegjiub/gists{/gist_id}","starred_url":"https://api.github.com/users/woegjiub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woegjiub/subscriptions","organizations_url":"https://api.github.com/users/woegjiub/orgs","repos_url":"https://api.github.com/users/woegjiub/repos","events_url":"https://api.github.com/users/woegjiub/events{/privacy}","received_events_url":"https://api.github.com/users/woegjiub/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T21:13:10Z","updated_at":"2018-10-29T21:13:10Z","author_association":"NONE","body":"It might be the same issue.\r\nIt doesn't seem to matter if I use dynamic or not.\r\nI've tried it with vue-persistedstate and vue-persist too.\r\n\r\nI can see that the values are there in localstorage, but they are replaced with the initial values on page reload.\r\n\r\n```typescript\r\nimport Vue from 'vue';\r\nimport Vuex from 'vuex';\r\nimport VuexPersistence from 'vuex-persist';\r\nimport {Module, VuexModule, Mutation, Action, getModule} from 'vuex-module-decorators';\r\n\r\nVue.use(Vuex);\r\n\r\ninterface RootState {\r\n  user: UserState;\r\n}\r\n\r\nexport const store = new Vuex.Store<RootState>({\r\n  plugins: [new VuexPersistence().plugin],\r\n});\r\n\r\nexport interface UserState {\r\n  token: string;\r\n  user: object;\r\n}\r\n\r\n@Module({dynamic: true, store, name: 'user', namespaced: true})\r\nclass UserModule extends VuexModule implements UserState {\r\n  public token = '';\r\n  public user = {};\r\n\r\n  get authHeader() {\r\n    return this.token === '' ? {} : { Authorization: `Token ${this.token}` };\r\n  }\r\n\r\n  @Mutation\r\n  public setSession(data: {token: string, user: object}) {\r\n    this.token = data.token;\r\n    this.user = data.user;\r\n  }\r\n\r\n  @Action({commit: 'setSession'})\r\n  public async login(payload: {email: string, password: string}) {\r\n    const data = (await requests.post('auth/login/', payload)).data;\r\n    return {token: data.token || '', user: data.user};\r\n  }\r\n\r\n  @Action({commit: 'setSession'})\r\n  public async logout() {\r\n    return {token: '', user: {}};\r\n  }\r\n}\r\n\r\nexport const User = getModule(UserModule);\r\n```\r\n"}}
{"actor":{"display_login":"woegjiub"}}