Skip to content

Commit

Permalink
fix(hydration): should not warn mismatch for nullish prop
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 12, 2023
1 parent 0b6effb commit 33159a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/runtime-core/__tests__/hydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@ describe('SSR hydration', () => {
mountWithHydration(`<div spellcheck></div>`, () =>
h('div', { spellcheck: '' })
)
mountWithHydration(`<div></div>`, () => h('div', { id: undefined }))
// boolean
mountWithHydration(`<select multiple></div>`, () =>
h('select', { multiple: true })
Expand Down
4 changes: 3 additions & 1 deletion packages/runtime-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,9 @@ function propHasMismatch(el: Element, key: string, clientValue: any): boolean {
? includeBooleanAttr(clientValue)
? ''
: false
: String(clientValue)
: clientValue == null
? false
: String(clientValue)
if (actual !== expected) {
mismatchType = `attribute`
mismatchKey = key
Expand Down

0 comments on commit 33159a5

Please sign in to comment.