mirror of https://github.com/vuejs/core.git
fix(runtime-core): handle component updates with only class/style bindings
This commit is contained in:
parent
c6a9787941
commit
35d91f4e18
|
@ -172,7 +172,14 @@ export function shouldUpdateComponent(
|
|||
if (patchFlag & PatchFlags.FULL_PROPS) {
|
||||
// presence of this flag indicates props are always non-null
|
||||
return hasPropsChanged(prevProps!, nextProps!)
|
||||
} else if (patchFlag & PatchFlags.PROPS) {
|
||||
} else {
|
||||
if (patchFlag & PatchFlags.CLASS) {
|
||||
return prevProps!.class === nextProps!.class
|
||||
}
|
||||
if (patchFlag & PatchFlags.STYLE) {
|
||||
return hasPropsChanged(prevProps!.style, nextProps!.style)
|
||||
}
|
||||
if (patchFlag & PatchFlags.PROPS) {
|
||||
const dynamicProps = nextVNode.dynamicProps!
|
||||
for (let i = 0; i < dynamicProps.length; i++) {
|
||||
const key = dynamicProps[i]
|
||||
|
@ -181,6 +188,7 @@ export function shouldUpdateComponent(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!optimized) {
|
||||
// this path is only taken by manually written render functions
|
||||
// so presence of any children leads to a forced update
|
||||
|
|
Loading…
Reference in New Issue