File tree 2 files changed +24
-5
lines changed
test/unit/features/options
2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -151,11 +151,6 @@ export function lifecycleMixin (Vue: Class<Component>) {
151
151
if ( vm . _watcher ) {
152
152
vm . _watcher . update ( )
153
153
}
154
- if ( vm . _watchers . length ) {
155
- for ( let i = 0 ; i < vm . _watchers . length ; i ++ ) {
156
- vm . _watchers [ i ] . update ( true /* shallow */ )
157
- }
158
- }
159
154
}
160
155
161
156
Vue . prototype . $destroy = function ( ) {
Original file line number Diff line number Diff line change @@ -349,4 +349,28 @@ describe('Options props', () => {
349
349
} ) . $mount ( )
350
350
expect ( console . error . calls . count ( ) ) . toBe ( 0 )
351
351
} )
352
+
353
+ // #3453
354
+ it ( 'should not fire watcher on object/array props when parent re-renders' , done => {
355
+ const spy = jasmine . createSpy ( )
356
+ const vm = new Vue ( {
357
+ data : {
358
+ arr : [ ]
359
+ } ,
360
+ template : '<test :prop="arr">hi</test>' ,
361
+ components : {
362
+ test : {
363
+ props : [ 'prop' ] ,
364
+ watch : {
365
+ prop : spy
366
+ } ,
367
+ template : '<div><slot></slot></div>'
368
+ }
369
+ }
370
+ } ) . $mount ( )
371
+ vm . $forceUpdate ( )
372
+ waitForUpdate ( ( ) => {
373
+ expect ( spy ) . not . toHaveBeenCalled ( )
374
+ } ) . then ( done )
375
+ } )
352
376
} )
You can’t perform that action at this time.
0 commit comments