-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
π¨ p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
Description
Vue version
3.5.13
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-exn7drue?file=src%2FApp.vue
Steps to reproduce
- Set the
app.config.warnRecursiveComputed
flag to true - Create a computed that mutates its dependencies
- Use that computed in the template
What is expected?
Vue should log a warning because the computed is still dirty after being evaluated
What is actually happening?
No warning is logged
System Info
Any additional comments?
The warning is mentioned in #10341, and the config option is added in 23953dd.
It seems that much of the code for computed refs was moved into a separate function, refreshComputed
, at which point the functionality was lost.
I got a minimal patch working by duplicating the initial dirty check into the finally
block after cleanupDeps
, though I'm not certain if that's the right place for it:
activeSub = prevSub
shouldTrack = prevShouldTrack
cleanupDeps(computed)
if (
computed._warnRecursive &&
!computed.isSSR &&
computed.deps &&
isDirty(computed)
) {
console.warn("O no", computed.fn)
}
computed.flags &= ~EffectFlags.RUNNING
In an ideal scenario the warning would be able to specify exactly which dependencies caused the computed to be dirty, but that might be too complex.
Metadata
Metadata
Assignees
Labels
π¨ p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.