1

I return a variable as a result of

  async asyncData({ redirect, params, store }) {

and that variable is:

  return {
    camera: c,

I am trying to clone it as

  created() {
    this.dummyCamera = this.camera

but even when I change anything to dummyCamera, it gets changed in this.camera too?

How I can stop this behaviour?

I want to compare both dummyCamera as well as this.camera when I change anything in dummyCamera, but right now I am unable to do so.

Even If I change anything in this.camera,

camera: {
  handler: function(newValue) {
    console.log(newValue)
    console.log(this.camera)
  },
  deep: true
}

both newValue and this.camera are the same? How I can stop this sync?

Junaid Farooq
  • 2,484
  • 5
  • 26
  • 63
  • Does this answer your question? [Restrict vue/vuex reactivity](https://stackoverflow.com/questions/44307077/restrict-vue-vuex-reactivity) – manniL Apr 01 '20 at 13:09
  • even on doing Object.freez, nothing gets freez, change in one object changing in other too – Junaid Farooq Apr 01 '20 at 14:07

1 Answers1

0

The only possibility to stop the sync is

  created() {
    this.dummyCamera = JSON.parse(JSON.stringify(this.camera)) 

this way you can use your newly assigned variable.

Junaid Farooq
  • 2,484
  • 5
  • 26
  • 63