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

watch reactive array callback called with new value only #1928

Closed
randName opened this issue Aug 21, 2020 · 1 comment
Closed

watch reactive array callback called with new value only #1928

randName opened this issue Aug 21, 2020 · 1 comment

Comments

@randName
Copy link

Version

3.0.0-rc.6

Reproduction link

https://codesandbox.io/s/quiet-dream-jwnql?file=/src/index.js

Steps to reproduce

watch a reactive array, the callback function is called with the new value only

What is expected?

second argument should be the old value

What is actually happening?

both arguments are the new value


potentially related to #1655 . Unsure if this is the proper way to watch for an array, since this returned a plain array before #1656 (it is a Proxy now)

Also is there a more idomatic way to watch for changes in an array of objects? e.g. leveraging what Vue already does for DOM updates.

@posva
Copy link
Member

posva commented Aug 21, 2020

See the note at https://vuejs.org/v2/api/#vm-watch, this is expected when mutating objects. Will pass on the information about the note missing in v3.

@posva posva closed this as completed Aug 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 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

2 participants