From c0d8db81a636f0ad1e725b7c04608d3a211cf163 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 27 Sep 2022 10:24:13 +0800 Subject: [PATCH] fix(runtime-core): unset removed props first in full diff mode fix #6571 --- packages/runtime-core/src/renderer.ts | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index 63d5de2db19..6c8ba205e90 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -1005,6 +1005,23 @@ function baseCreateRenderer( isSVG: boolean ) => { if (oldProps !== newProps) { + if (oldProps !== EMPTY_OBJ) { + for (const key in oldProps) { + if (!isReservedProp(key) && !(key in newProps)) { + hostPatchProp( + el, + key, + oldProps[key], + null, + isSVG, + vnode.children as VNode[], + parentComponent, + parentSuspense, + unmountChildren + ) + } + } + } for (const key in newProps) { // empty string is not valid prop if (isReservedProp(key)) continue @@ -1025,23 +1042,6 @@ function baseCreateRenderer( ) } } - if (oldProps !== EMPTY_OBJ) { - for (const key in oldProps) { - if (!isReservedProp(key) && !(key in newProps)) { - hostPatchProp( - el, - key, - oldProps[key], - null, - isSVG, - vnode.children as VNode[], - parentComponent, - parentSuspense, - unmountChildren - ) - } - } - } if ('value' in newProps) { hostPatchProp(el, 'value', oldProps.value, newProps.value) }