Environment
We have a Vue Cli using Vue 2. Vuex and TypeScript are installed
Issue
Currently we’re getting some vuex state data (via a vuex getter). Then working with it. However, if we mutate the "gotten data" it affects the vuex state. It seems crazy! Here’s a very silly stripped down version of a services module:
// vuex
import { mapState } from 'vuex'
// store
import store from './../store';
// types
import { ServiceType } from './../types/services'
export default class TestService implements ServiceType {
serviceFunction(someArray: Array<number>) {
// this will return some nested/multidimensional data:
// [
// { prop: [[1, 2, 3, 4]] }
// ]
let data = store.getters['getTestStoreData']
data[0].prop[0] = someArray // doesn't mutate the state
data[0].prop = [someArray] // mutates the state
data[0].prop.splice(0, 1, someArray) // mutates the state
}
}
The very very stripped down getter looks something like this:
getTestStoreData(state) { return state.data }
So 2 of the 3 above will mutate the store, since they mutate the data variable… Which leads me to believe the getter passes a reference of the state data.
Anyone have insight into this? Or know a good way to handle it?
I’ve got some ideas about passing just the nested data from the store. This stackoverflow answer is some of the best insight I’ve found.
modafinil and birth control – provigil settlement modafinil side effects
online order prednisone – prednisone 4mg tab deltasone 50 mg cost
order provigil online – buy provigil generic modafinil
buy azithromycin 500mg online – zithromax for sale azithromycin 250
buy furosemide online uk – furosemide brand name in usa can i buy lasix over the counter
order clomiphene – bbclomid.com purchase clomiphene
female viagra pills uk – viagra 20 mg daily generic viagra online 25mg
viagra buy uk – viagra on sale
write research paper for me – essay editor service academic writing article
stromectol cream – stromectol buy online ivermectin syrup
prednisone over the counter uk – prednisone tabs 20 mg 80 mg prednisone daily
furosemide medicine – generic clomid furosemide 10 mg tablet
ventolin cost uk – can i buy ventolin over the counter in usa ventolin 90
ivermectin 18mg – ivermectin lotion for scabies ivermectin generic name
ivermectin pills human – buy stromectol 12mg ivermectin 1 cream generic
cheapest generic sildenafil – sildenafil samples sildenafil reviews
how much is accutane cost – how to get cheap accutane accutane online for sale
buy nothing day essay – write my paper essays online to buy
vardenafil online bestellen – vardeed.com hims ed pills
78976 983556A thoughtful insight and tips I will use on my blog. Youve certainly spent lots of time on this. Thank you! 101975
hydroxychloroquine for sale – plaquenil lupus prednisone 16 mg
ivermectin lotion for lice – buy ivermectin canada stromectol us
generic viagra 100mg price in india – viagra 25mg for sale can i buy viagra without prescription
834613 35793I conceive this site contains some rattling superb details for every person : D. 151899
prednisone 5mg – prednisone 300 mg prednisone pills
ivermectin generic name – ivermectin buy australia ivermectin tablets
canadian online pharmacy sildenafil – buy sildenafil online how to buy viagra usa
canadian cialis – Cialis usa canadadrugpharmacy com
over the counter viagra usa – myviasites.com viagra price comparison usa
sildenafil 200mg en ligne – tadalafil 5mg gГ©nГ©rique cialis 10mg generique
cenforce 50mg for sale – buy diltiazem 180mg generic purchase acyclovir
cialis without prescription tadalafil
tadalafil drug where to get tadalafil
buy tadalis side effects for tadalafil
best price usa tadalafil tadalafil side effects
https://cialisedot.com/ best price usa tadalafil
cost of cialis https://cialisusdc.com/
cost of cialis tadalafil side effects
buy stromectol buy 6mg stromectol
buy stromectol 6 mg
https://ivermectinetc.com/ buy stromectol usa
buy generic ivermectin online ivermectin tablets