Skip to content

newValue and oldValue parameters are the same when deep watching an object #2164

@aidangarza

Description

@aidangarza

I have a component with these options:

{
  data() {
    return {
      ...
      controls: {
        ...
        showProduct: {
          11: true,
          13: true,
          15: false
        }
      }
    }
  },

  watch: {
    ...
    'controls.showProduct': {
      handler(newValue, oldValue) { // some function },
      deep: true
    }
  }
}

Whenever I change the value of any product (i.e. controls.showProduct[ x ]) the watcher fires, but newValue and oldValue are always the same with controls.showProduct[ x ] set to the new value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions