File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ packages/server-renderer/client-plugin.js
12
12
packages /template-compiler /build.js
13
13
packages /template-compiler /browser.js
14
14
.vscode
15
+ .idea
15
16
dist
16
17
temp
17
18
types /v3-generated.d.ts
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ function callActivatedHooks(queue) {
156
156
*/
157
157
export function queueWatcher ( watcher : Watcher ) {
158
158
const id = watcher . id
159
- if ( has [ id ] != null ) {
159
+ if ( id !== Infinity && has [ id ] != null ) {
160
160
return
161
161
}
162
162
Original file line number Diff line number Diff line change @@ -672,6 +672,51 @@ describe('api: watch', () => {
672
672
await nextTick ( )
673
673
expect ( dom ! . tagName ) . toBe ( 'P' )
674
674
} )
675
+
676
+ // #12664
677
+ it ( 'flush: post watchers from 2 components should both fire after template refs updated' , async ( ) => {
678
+ let appPostWatcherTrigger = false
679
+ let childComponentPostWatcherTrigger = false
680
+
681
+ const Child = {
682
+ setup ( ) {
683
+ const el = ref ( ) ;
684
+ watch (
685
+ el ,
686
+ ( ) => {
687
+ childComponentPostWatcherTrigger = true
688
+ } ,
689
+ { flush : 'post' }
690
+ )
691
+ return { el } ;
692
+ } ,
693
+ template : `<div><span ref="el">hello child</span></div>`
694
+ }
695
+ const App = {
696
+ components : { Child } ,
697
+ setup ( ) {
698
+ const el = ref ( ) ;
699
+ watch (
700
+ el ,
701
+ ( ) => {
702
+ appPostWatcherTrigger = true
703
+ } ,
704
+ { flush : 'post' }
705
+ )
706
+ return { el } ;
707
+ } ,
708
+ template : `<div><Child /><span ref="el">hello app1</span></div>`
709
+ }
710
+
711
+ const container = document . createElement ( 'div' )
712
+ const root = document . createElement ( 'div' )
713
+ container . appendChild ( root )
714
+ new Vue ( App ) . $mount ( root )
715
+
716
+ await nextTick ( )
717
+ expect ( appPostWatcherTrigger ) . toBe ( true )
718
+ expect ( childComponentPostWatcherTrigger ) . toBe ( true )
719
+ } )
675
720
676
721
it ( 'deep' , async ( ) => {
677
722
const state = reactive ( {
You can’t perform that action at this time.
0 commit comments