File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -1516,5 +1516,10 @@ describe('SSR hydration', () => {
1516
1516
mountWithHydration ( `<input />` , ( ) => h ( 'input' , { from : { } } ) )
1517
1517
expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1518
1518
} )
1519
+
1520
+ test ( 'should not warn on falsy bindings of non-property keys' , ( ) => {
1521
+ mountWithHydration ( `<button />` , ( ) => h ( 'button' , { href : undefined } ) )
1522
+ expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
1523
+ } )
1519
1524
} )
1520
1525
} )
Original file line number Diff line number Diff line change @@ -759,18 +759,18 @@ function propHasMismatch(
759
759
actual = el . hasAttribute ( key )
760
760
expected = includeBooleanAttr ( clientValue )
761
761
} else {
762
- // #10000 some attrs such as textarea.value can't be get by `hasAttribute`
763
762
if ( el . hasAttribute ( key ) ) {
764
763
actual = el . getAttribute ( key )
765
- } else if ( key in el ) {
764
+ } else {
765
+ // #10000 some attrs such as textarea.value can't be retrieved by `hasAttribute`
766
766
const serverValue = el [ key as keyof typeof el ]
767
- if ( ! isObject ( serverValue ) ) {
768
- actual = serverValue == null ? '' : String ( serverValue )
769
- }
770
- }
771
- if ( ! isObject ( clientValue ) ) {
772
- expected = clientValue == null ? '' : String ( clientValue )
767
+ actual =
768
+ isObject ( serverValue ) || serverValue == null
769
+ ? ''
770
+ : String ( serverValue )
773
771
}
772
+ expected =
773
+ isObject ( clientValue ) || clientValue == null ? '' : String ( clientValue )
774
774
}
775
775
if ( actual !== expected ) {
776
776
mismatchType = `attribute`
You can’t perform that action at this time.
0 commit comments