vuejs / vuejs/docs

Add a remark about watching objects/array refs

Open
#2,454 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
3.2k
Forks
5k
Avg merge
14d 17h
Merged PRs (30d)
1

Description

From the docs at least for me it's not obvious that watching a ref is actually shallow watching its value only.
The problem that we know that an object/array ref makes the object/array accessed through the ref's value reactive.
So intuitively it could seem that watching an object/array ref is deep like watching a reactive variable, but it's not.

I think a remark about this case should be added in the docs, otherwise I see periodically that kind of questions on the stackoverflow:

https://stackoverflow.com/questions/76786334/cannot-watch-an-array-ref-in-vue-3/76786671

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by finding the Vue 3 documentation section that explains watch sources, refs, and deep watching, then compare its wording with the linked Stack Overflow question. Add a remark clarifying that watching an object or array ref watches its value shallowly, and verify that the surrounding guidance remains accurate.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.