Closed JFGHT closed 6 years ago
I wasn't sure this was the place to post this issue and I'm still not sure but anyway I'm updating it. I found a workaround that it's not that good performance-wise:
computed: {
...mapState({
balance: state => state.balances,
asset: state => state.asset,
payments: state => cloneDeep(state.payments)
})
},
Using lodash's cloneDeep will make it.
It's the same array with new elements added to it. It's modified inline using splice
, that's why newData === oldData
🙂
I've got a Vuex state just like this:
How do you watch in a Vue component that state slice when a payment is added to the Vuex store? My code:
Both, newPaymentData and oldPaymentData are exactly the same in the watch (when they shouldn't be).