Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$storage.state not reactive #155

Open
atinux opened this issue Nov 27, 2020 — with Volta.net · 4 comments
Open

$storage.state not reactive #155

atinux opened this issue Nov 27, 2020 — with Volta.net · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

Copy link
Member

atinux commented Nov 27, 2020

I tried a demonstration using CodeSandBox with disabling Vuex.

https://codesandbox.io/s/flamboyant-browser-cpucn?file=/pages/index.vue

I actually have to call $forceUpdate() in the component, It's weird since we use Vue.set(), maybe we should define the state using Vue.observable ?

@atinux
Copy link
Member Author

atinux commented Nov 27, 2020

Also, the token in the localStorage and cookie is undefinedtoken because I specific localStorage: true:

Screenshot 2020-11-27 at 13 43 35

@pi0
Copy link
Member

pi0 commented Nov 28, 2020

I can confirm the bug with store disabled. We indeed need to use observable (and probably also document better about initialState)

@pi0 pi0 added the bug Something isn't working label Nov 28, 2020
@pi0
Copy link
Member

pi0 commented Dec 4, 2020

Auth module uses same implementation which is probably affected: https://github.com/nuxt-community/auth-module/blob/83adce54190f097a965a33787f96faf9eb479f97/src/core/storage.ts#L116

@atinux atinux added the help wanted Extra attention is needed label Jan 25, 2021 — with Volta.net
@selimdev00
Copy link

Also, the token in the localStorage and cookie is undefinedtoken because I specific localStorage: true:

Screenshot 2020-11-27 at 13 43 35

I guess you need to specify prefix in options like this:

localStorage: {
  prefix: 'some-prefix-',
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants