File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
- import { DebuggerOptions , ReactiveEffect } from './effect'
1
+ import {
2
+ DebuggerOptions ,
3
+ pauseTracking ,
4
+ ReactiveEffect ,
5
+ resetTracking
6
+ } from './effect'
2
7
import { Ref , trackRefValue , triggerRefValue } from './ref'
3
8
import { hasChanged , isFunction , NOOP } from '@vue/shared'
4
9
import { ReactiveFlags , toRaw } from './reactive'
@@ -65,19 +70,21 @@ export class ComputedRefImpl<T> {
65
70
get value ( ) {
66
71
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
67
72
const self = toRaw ( this )
68
- if ( ! self . _dirty ) {
73
+ if ( ! self . _dirty && self . _computedsToAskDirty . length ) {
74
+ pauseTracking ( )
69
75
for ( const computedToAskDirty of self . _computedsToAskDirty ) {
70
76
computedToAskDirty . value
71
77
if ( self . _dirty ) {
72
78
break
73
79
}
74
80
}
81
+ resetTracking ( )
75
82
}
76
83
trackRefValue ( self )
77
84
if ( self . _dirty || ! self . _cacheable ) {
78
85
const newValue = self . effect . run ( ) !
79
86
if ( hasChanged ( self . _value , newValue ) ) {
80
- triggerRefValue ( this , undefined )
87
+ triggerRefValue ( self , undefined )
81
88
}
82
89
self . _value = newValue
83
90
self . _dirty = false
You can’t perform that action at this time.
0 commit comments