fix(runtime-core): ensure mergeProps skips undefined event handlers (#5299)

fix #5296
This commit is contained in:
Thorsten Lünborg
2022-01-21 07:13:29 +01:00
committed by GitHub
parent 2f91872e7b
commit c35ec47d73
3 changed files with 6 additions and 1 deletions

View File

@@ -446,6 +446,10 @@ describe('vnode', () => {
onClick: [clickHandler1, clickHandler2],
onFocus: focusHandler2
})
let props3: Data = { onClick: undefined }
expect(mergeProps(props1, props3)).toMatchObject({
onClick: clickHandler1
})
})
test('default', () => {

View File

@@ -798,6 +798,7 @@ export function mergeProps(...args: (Data & VNodeProps)[]) {
const existing = ret[key]
const incoming = toMerge[key]
if (
incoming &&
existing !== incoming &&
!(isArray(existing) && existing.includes(incoming))
) {