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', () => {
15161516 mountWithHydration ( `<input />` , ( ) => h ( 'input' , { from : { } } ) )
15171517 expect ( `Hydration attribute mismatch` ) . not . toHaveBeenWarned ( )
15181518 } )
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+ } )
15191524 } )
15201525} )
Original file line number Diff line number Diff line change @@ -759,18 +759,18 @@ function propHasMismatch(
759759 actual = el . hasAttribute ( key )
760760 expected = includeBooleanAttr ( clientValue )
761761 } else {
762- // #10000 some attrs such as textarea.value can't be get by `hasAttribute`
763762 if ( el . hasAttribute ( key ) ) {
764763 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`
766766 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 )
773771 }
772+ expected =
773+ isObject ( clientValue ) || clientValue == null ? '' : String ( clientValue )
774774 }
775775 if ( actual !== expected ) {
776776 mismatchType = `attribute`
You can’t perform that action at this time.
0 commit comments