-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Describe the bug
refManualReset() is implemented using customRef.
Because customRef only tracks access through its get() and triggers updates only when set() is called, deep mutations inside the stored object are never tracked.
Reproduction
💡 Expected behavior
In fact, I'm not asking for a change to the implementation, since user can solve this simply by add reactive to the defaultValue.
Instead, I propose adding a clear documentation note:
refManualReset()is shallow.- Deep mutations inside the object will not trigger reactive updates unless the object itself is wrapped with
reactive(). - Only calling
set()triggers updates — internal mutations do not.
This is especially important because ref() sometimes appears to react to deep mutations in templates due to unwrapping + dependency tracking, which makes refManualReset() ’s behavior look inconsistent if developers are unaware of customRef limitations.
Suggested documentation note:
Note:
refManualReset()usescustomRef, which does not provide deep reactivity.
Only assignments to the ref itself (ref.value = ...) trigger updates.
Mutating nested properties (ref.value.foo.bar = ...) will not trigger updates unless the internal value is made reactive manually (e.g.,reactive()).
📌 Why this matters
refManualReset() is really useful in form states and similar contexts where users naturally expect deep mutations to be reactive.
Clarifying this behavior will prevent misuse and confusion.
System Info
System:
OS: Windows 10 10.0.19045
CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Memory: 7.25 GB / 31.95 GB
Binaries:
Node: 20.19.6 - C:\nvm4w\nodejs\node.EXE
npm: 10.8.2 - C:\nvm4w\nodejs\npm.CMD
pnpm: 10.22.0 - C:\Users\yyh\AppData\Local\pnpm\pnpm.CMD
Browsers:
Edge: Chromium (142.0.3595.80)
Internet Explorer: 11.0.19041.5794
npmPackages:
@vueuse/core: ^14.0.0 => 14.0.0
vue: ^3.5.18 => 3.5.25Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.