File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,21 @@ describe('api: watch', () => {
176
176
] )
177
177
} )
178
178
179
+ it ( 'watching multiple sources: undefined initial values and immediate: true' , async ( ) => {
180
+ const a = ref ( )
181
+ const b = ref ( )
182
+ let called = false
183
+ watch (
184
+ [ a , b ] ,
185
+ ( ) => {
186
+ called = true
187
+ } ,
188
+ { immediate : true }
189
+ )
190
+ await nextTick ( )
191
+ expect ( called ) . toBe ( true )
192
+ } )
193
+
179
194
it ( 'watching multiple sources: readonly array' , async ( ) => {
180
195
const state = reactive ( { count : 1 } )
181
196
const status = ref ( false )
Original file line number Diff line number Diff line change @@ -295,7 +295,9 @@ function doWatch(
295
295
return NOOP
296
296
}
297
297
298
- let oldValue = isMultiSource ? [ ] : INITIAL_WATCHER_VALUE
298
+ let oldValue = isMultiSource
299
+ ? new Array ( ( source as [ ] ) . length ) . fill ( INITIAL_WATCHER_VALUE )
300
+ : INITIAL_WATCHER_VALUE
299
301
const job : SchedulerJob = ( ) => {
300
302
if ( ! effect . active ) {
301
303
return
You can’t perform that action at this time.
0 commit comments