Skip to content

Commit 33159a5

Browse files
committed
fix(hydration): should not warn mismatch for nullish prop
1 parent 0b6effb commit 33159a5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/runtime-core/__tests__/hydration.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,7 @@ describe('SSR hydration', () => {
13971397
mountWithHydration(`<div spellcheck></div>`, () =>
13981398
h('div', { spellcheck: '' })
13991399
)
1400+
mountWithHydration(`<div></div>`, () => h('div', { id: undefined }))
14001401
// boolean
14011402
mountWithHydration(`<select multiple></div>`, () =>
14021403
h('select', { multiple: true })

packages/runtime-core/src/hydration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,9 @@ function propHasMismatch(el: Element, key: string, clientValue: any): boolean {
740740
? includeBooleanAttr(clientValue)
741741
? ''
742742
: false
743-
: String(clientValue)
743+
: clientValue == null
744+
? false
745+
: String(clientValue)
744746
if (actual !== expected) {
745747
mismatchType = `attribute`
746748
mismatchKey = key

0 commit comments

Comments
 (0)