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

auth.currentuser() method is mutating vuex store #64

Open
yashmc3 opened this issue Nov 21, 2019 · 2 comments
Open

auth.currentuser() method is mutating vuex store #64

yashmc3 opened this issue Nov 21, 2019 · 2 comments

Comments

@yashmc3
Copy link

yashmc3 commented Nov 21, 2019

const user = auth.currentUser();
user
  .logout()
  .then(response => console.log("User logged out");)
  .catch(error => {
    console.log("Failed to logout user: %o", error);
    throw error;
  });

** Error: [vuex] do not mutate vuex store state outside mutation handlers.

I am getting the above error when first line "const user = auth.currentUser();" is executed.
It seems that auth.currentuser() method mutates the vuex store.

@luukdv
Copy link

luukdv commented Jan 5, 2020

@yashmc3 Can you share a link to the repository or sandbox? That should be helpful for debugging.

@ttntm
Copy link
Contributor

ttntm commented Jun 2, 2020

Same here, based on https://github.com/chiubaca/vue-netlify-fauna-starter-kit

Here's the stack trace:

vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in callback for watcher "function () { return this._data.$$state }": "Error: [vuex] do not mutate vuex store state outside mutation handlers."

(found in <Root>)
warn @ vue.runtime.esm.js?2b0e:619
logError @ vue.runtime.esm.js?2b0e:1884
globalHandleError @ vue.runtime.esm.js?2b0e:1879
handleError @ vue.runtime.esm.js?2b0e:1839
run @ vue.runtime.esm.js?2b0e:4570
update @ vue.runtime.esm.js?2b0e:4542
notify @ vue.runtime.esm.js?2b0e:730
reactiveSetter @ vue.runtime.esm.js?2b0e:1055
clearSession @ user.js?3020:183
Promise.then (async)
logout @ user.js?3020:72
eval @ user.js?0f9a:110
attemptLogout @ user.js?0f9a:109
wrappedActionHandler @ vuex.esm.js?2f62:792
dispatch @ vuex.esm.js?2f62:457
boundDispatch @ vuex.esm.js?2f62:347
local.dispatch @ vuex.esm.js?2f62:720
mappedAction @ vuex.esm.js?2f62:1005
logout @ NavAuth.vue?72bf:121
click @ NavAuth.vue?e190:17
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
invoker @ vue.runtime.esm.js?2b0e:2179
original._wrapper @ vue.runtime.esm.js?2b0e:6917

vue.runtime.esm.js?2b0e:1888 Error: [vuex] do not mutate vuex store state outside mutation handlers.
    at assert (vuex.esm.js?2f62:94)
    at Vue.store._vm.$watch.deep (vuex.esm.js?2f62:834)
    at Watcher.run (vue.runtime.esm.js?2b0e:4568)
    at Watcher.update (vue.runtime.esm.js?2b0e:4542)
    at Dep.notify (vue.runtime.esm.js?2b0e:730)
    at User.reactiveSetter [as token] (vue.runtime.esm.js?2b0e:1055)
    at User.clearSession (user.js?3020:183)

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

No branches or pull requests

3 participants