1๐
โ
my guess is your issue lies here:
TL;DR โ you pass your getter as valor to your action.
only a guess โ as i cant debug your code
store.dispatch('profundidadeSondagem/MODIFY', patologia).catch(() => { this.valorProfundidade = this.profundidadeSondagem; })
as you assign a reference from your rootState[...]
and thus you change the properties of the rootState[...]
in your component past the first run.
So your code then behaves like:
let patologia = {
arcada: this.arcada,
sextante: this.sextante,
dente: "dente_" + this.dente,
face: this.face_json,
// valor: this.valorProfundidade, ///* same as */ valor: this.profundidadeSondagem, /* same as */ valor: this.$store.getters['profundidadeSondagem/profundidadeSondagem'](...),
modelRefs: modelRefs,
id: this.changedId,
valorInserido: this.valorInserido,
};
A solution can be to this.valorProfundidade = this.profundidadeSondagem.slice();
as long it is an array or Object.assign({},...)
โ so you prevent the references
๐คEstradiaz
Source:stackexchange.com