fix https://github.com/vuejs/ecosystem-ci/actions/runs/23529115737/job/68488818862
@@ -477,6 +477,12 @@ describe('vnode', () => {
expect(mergeProps({ onClick: null })).toMatchObject({
onClick: null,
})
+ expect(
+ mergeProps({ 'onUpdate:modelValue': undefined }),
+ ).not.toHaveProperty('onUpdate:modelValue')
+ expect(mergeProps({ 'onUpdate:modelValue': null })).not.toHaveProperty(
+ 'onUpdate:modelValue',
+ )
test('default', () => {
@@ -6,6 +6,7 @@ import {
extend,
isArray,
isFunction,
+ isModelListener,
isObject,
isOn,
isString,
@@ -891,7 +892,13 @@ export function mergeProps(...args: (Data & VNodeProps)[]): Data {
ret[key] = existing
? [].concat(existing as any, incoming as any)
: incoming
- } else if (incoming == null && existing == null) {
+ } else if (
+ incoming == null &&
+ existing == null &&
+ // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
+ // the model listener.
+ !isModelListener(key)
+ ) {
ret[key] = incoming
}
} else if (key !== '') {