@@ -226,7 +226,8 @@ export function updateProps(
226
226
rawCurrentProps ,
227
227
camelizedKey ,
228
228
value ,
229
- instance
229
+ instance ,
230
+ false /* isAbsent */
230
231
)
231
232
}
232
233
} else {
@@ -271,10 +272,11 @@ export function updateProps(
271
272
) {
272
273
props [ key ] = resolvePropValue (
273
274
options ,
274
- rawProps || EMPTY_OBJ ,
275
+ rawCurrentProps ,
275
276
key ,
276
277
undefined ,
277
- instance
278
+ instance ,
279
+ true /* isAbsent */
278
280
)
279
281
}
280
282
} else {
@@ -363,14 +365,17 @@ function setFullProps(
363
365
}
364
366
365
367
if ( needCastKeys ) {
368
+ const rawCurrentProps = toRaw ( props )
369
+ const castValues = rawCastValues || EMPTY_OBJ
366
370
for ( let i = 0 ; i < needCastKeys . length ; i ++ ) {
367
371
const key = needCastKeys [ i ]
368
372
props [ key ] = resolvePropValue (
369
373
options ! ,
370
- rawCastValues || EMPTY_OBJ ,
374
+ rawCurrentProps ,
371
375
key ,
372
- rawCastValues && rawCastValues [ key ] ,
373
- instance
376
+ castValues [ key ] ,
377
+ instance ,
378
+ ! hasOwn ( castValues , key )
374
379
)
375
380
}
376
381
}
@@ -383,7 +388,8 @@ function resolvePropValue(
383
388
props : Data ,
384
389
key : string ,
385
390
value : unknown ,
386
- instance : ComponentInternalInstance
391
+ instance : ComponentInternalInstance ,
392
+ isAbsent : boolean
387
393
) {
388
394
const opt = options [ key ]
389
395
if ( opt != null ) {
@@ -412,13 +418,13 @@ function resolvePropValue(
412
418
}
413
419
// boolean casting
414
420
if ( opt [ BooleanFlags . shouldCast ] ) {
415
- if (
421
+ if ( isAbsent && ! hasDefault ) {
422
+ value = false
423
+ } else if (
416
424
opt [ BooleanFlags . shouldCastTrue ] &&
417
425
( value === '' || value === hyphenate ( key ) )
418
426
) {
419
427
value = true
420
- } else if ( ! hasOwn ( props , key ) && ! hasDefault ) {
421
- value = false
422
428
}
423
429
}
424
430
}
0 commit comments