Support a reactive proxy of the object with rollback
What problem does this feature solve?
This would allow
- take snapshots easily any elegantly
- roll back to any snapshot you want easily any elegantly
What does the proposed API look like?
const {state, backup, rollback} = reactiveWithBackUp({a: 1})
// before edit state
backup('tag')
state.value.a = 2
// cancel
rollback('tag')
console.log(state.value.a) // 1
This is not a concern for Vue core. Check out https://vueuse.org/core/userefhistory/ for something relevant.