const colect = ref([... ]) const item = ref({... }) The dilemma is that, whe" /> const colect = ref([... ]) const item = ref({... }) The dilemma is that, whe" /> const colect = ref([... ]) const item = ref({... }) The dilemma is that, whe"/>

How do I roll back the values of the items or collections after an unexpected error?

36 Views Asked by At
<q-select v-model="item" :options="colect">

<q-input v-model="item.name">

const colect = ref([... ])

const item = ref({... })

The dilemma is that, when trying to save the changes in the db if an unexpected error occurs I must go back the changes, but unfortunately the previous value of the item is not saved anywhere previously.

The question is: How do I prevent the item from also being modified in the collection?

1

There are 1 best solutions below

1
张文玉 On

const temp = lodash.cloneDeep([...])

Cache the collection