-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Version
3.0.1
Reproduction link
https://github.com/davewood/vuejs-demo/tree/vuex_mutation_error
Steps to reproduce
git clone -b vuex_mutation_error git@github.com:davewood/vuejs-demo.git
cd vuejs-demo
npm install
npm run dev
trigger error in console by changing the language in top right corner
What is expected?
the state is changed and a notification is shown as expected but i dont get an error in the console
details:
- store has an array of notifications
- notifications are added using a mutation in src/store.js
- global Vue handler to trigger notification is installed in src/notify.js
What is actually happening?
the code works but there is an error in the console
[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>) 9:579:7
warn webpack-internal:///9:579:7
logError webpack-internal:///9:1714:5
globalHandleError webpack-internal:///9:1709:3
handleError webpack-internal:///9:1698:3
run webpack-internal:///9:3209:11
update webpack-internal:///9:3181:5
notify webpack-internal:///9:685:5
mutator webpack-internal:///9:843:5
add_notification/< webpack-internal:///116:21:9
Error: [vuex] Do not mutate vuex store state outside mutation handlers.
Stack trace:
assert@webpack-internal:///50:104:27
enableStrictMode/<@webpack-internal:///50:753:7
run@webpack-internal:///9:3207:11
update@webpack-internal:///9:3181:5
notify@webpack-internal:///9:685:5
mutator@webpack-internal:///9:843:5
add_notification/<@webpack-internal:///116:21:9
9:1718:5
logError webpack-internal:///9:1718:5
globalHandleError webpack-internal:///9:1709:3
handleError webpack-internal:///9:1698:3
run webpack-internal:///9:3209:11
update webpack-internal:///9:3181:5
notify webpack-internal:///9:685:5
mutator webpack-internal:///9:843:5
add_notification/< webpack-internal:///116:21:9