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 array of undefined #1655

Closed
tanhauhau opened this issue Jul 20, 2020 · 1 comment · Fixed by #1656
Closed

watch reactive array callback called with array of undefined #1655

tanhauhau opened this issue Jul 20, 2020 · 1 comment · Fixed by #1656

Comments

@tanhauhau
Copy link
Contributor

Version

3.0.0-rc.2

Reproduction link

https://codesandbox.io/s/fervent-sun-87su3?file=/src/index.js

Steps to reproduce

watch a reactive array, the callback function is called with array of undefined

What is expected?

callback function is called with array of undefined

What is actually happening?

callback function is called with the reactive array value

@posva
Copy link
Member

posva commented Jul 20, 2020

as the warning suggests, you need to use a function: watch(() => array with reactive. You will also need { deep: true } to track changes inside of the array

tanhauhau added a commit to tanhauhau/vue-next that referenced this issue Jul 20, 2020
yyx990803 pushed a commit that referenced this issue Jul 20, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 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

Successfully merging a pull request may close this issue.

2 participants