Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why createRef setter not compare old value with the new? #1012

Closed
Maorey opened this issue Apr 21, 2020 · 0 comments
Closed

Why createRef setter not compare old value with the new? #1012

Maorey opened this issue Apr 21, 2020 · 0 comments

Comments

@Maorey
Copy link

Maorey commented Apr 21, 2020

Version

3.0.0-beta.3

Reproduction link

https://github.com/vuejs/vue-next/blob/6fefeafe988b1e1f14224dfb11b87d4710042313/packages/reactivity/src/ref.ts#L58

Steps to reproduce

import { ref } from 'vue'

export default {
  template: '<button @click="inc">Clicked {{ count }} times.</button>',
  setup() {
    const count = ref(0)
    const inc = () => {
      count.value = 0 // not change
    }

    return {
      count,
      inc
    }
  }
}

What is expected?

do nothing

What is actually happening?

triggered

pikax pushed a commit to pikax/vue-next that referenced this issue Apr 29, 2020
Note: shallowRef will always trigger on assignment because it does not
account for deep mutations

close vuejs#1012
@github-actions github-actions bot locked and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant