Document how some classes can avoid being reactivity
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 3.2k
- Forks
- 5k
- Avg merge
- 14d 17h
- Merged PRs (30d)
- 1
Description
What problem does this feature solve?
Apologies if this is well documented somewhere, I did not find it.
It is common to use some "primitive" objects that actually represent simple value.
Built-in the browser we have Promise, Date, RegExp and friends.
In libraries I could cite Moment or Luxon (DateTime, Interval) that serve similar purposes.
Those objects shouldn't be wrapped by reactive Vue proxy.
Browser built-ins are already taken care of by Vue itself, but JS libraries can easily be wrapped when unsuspecting.
There's a need for an official way to prevent some class of objects from being reactive.
What does the proposed API look like?
In Vue 3.0.2, I see two ways to achieve this.
Either add __v_skip: true on the prototype of those objects. This would require documenting __v_skip as an official public API with long-term stability and support.
Or trick Vue into thinking they are unknown object types by modifying their type tag, i.e. add Symbol.toStringTag on their prototype and make it anything but the string "Object".
Option 3: add a new way to achieve this.
I personally use the second option and I think it's good enough, but it would need to be documented officially.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing Vue 3 reactivity documentation and the behavior described for __v_skip and Symbol.toStringTag. Confirm which approach is officially supported before documenting it, and make the guidance cover library objects such as Moment or Luxon without presenting an unapproved workaround as stable API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100