Subscribe on changes!

Support a reactive proxy of the object with rollback

avatar
Jun 7th 2022

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
avatar
Jun 8th 2022

This is not a concern for Vue core. Check out https://vueuse.org/core/userefhistory/ for something relevant.