[Vuejs]-Vuex: Why array in state is mutated (possibly via a computed property) even though not committed / dispatched

0👍

You’re trying to update the computed property in your Home.vue file. The code block is this :

snapshot.forEach(function(snap) {
                            vm.allQuotes.push({
                                key: snap.key,
                                category: snap.val().category,
                                quoteTxt: snap.val().quoteTxt
                            })
                        })

If you try to change the computed property directly, vue will replace it with your state on each tick. So this is not a true approach. If you want to change the state you should do that by actions and mutations.

Hope this helps.

Leave a comment