File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -100,17 +100,24 @@ function getterFn (key, fn) {
100100
101101 let getter = fn . get
102102
103- if ( fn . hasOwnProperty ( 'watch' ) || fn . hasOwnProperty ( 'shouldUpdate' ) ) {
104- let shouldUpdate = fn . shouldUpdate || ( ( ) => true )
105- let watcher = fn . watch || ( ( ) => { } )
103+ if ( fn . hasOwnProperty ( 'watch' ) ) {
104+ const previousGetter = getter
106105 getter = function getter ( ) {
107- watcher . call ( this )
108- if ( shouldUpdate . call ( this ) ) {
109- return fn . get . call ( this )
106+ fn . watch . call ( this )
107+ return previousGetter . call ( this )
108+ }
109+ }
110+
111+ if ( fn . hasOwnProperty ( 'shouldUpdate' ) ) {
112+ const previousGetter = getter
113+ getter = function getter ( ) {
114+ if ( fn . shouldUpdate . call ( this ) ) {
115+ return previousGetter . call ( this )
110116 }
111117 return DidNotUpdate
112118 }
113119 }
120+
114121 if ( isComputedLazy ( fn ) ) {
115122 const nonLazy = getter
116123 getter = function lazyGetter ( ) {
You can’t perform that action at this time.
0 commit comments