]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): unset removed props first in full diff mode
authorEvan You <yyx990803@gmail.com>
Tue, 27 Sep 2022 02:24:13 +0000 (10:24 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 27 Sep 2022 02:24:13 +0000 (10:24 +0800)
fix #6571

packages/runtime-core/src/renderer.ts

index 63d5de2db19a6832ef2b240dc9fed4b78487693b..6c8ba205e90259ea1a94ace5620fb6a9afe9e3a7 100644 (file)
@@ -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)
       }