Skip to content

Commit

Permalink
fix(runtime-core): unset removed props first in full diff mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 authored and chrislone committed Feb 4, 2023
1 parent 42bf713 commit c3bcd82
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions packages/runtime-core/src/renderer.ts
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down

0 comments on commit c3bcd82

Please sign in to comment.