From: Evan You Date: Thu, 13 Feb 2020 22:27:52 +0000 (-0500) Subject: fix(runtime-core): handle component updates with only class/style bindings X-Git-Tag: v3.0.0-alpha.5~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35d91f4e18ccb72cbf39a86fe8f39060f0bf075e;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): handle component updates with only class/style bindings --- diff --git a/packages/runtime-core/src/componentRenderUtils.ts b/packages/runtime-core/src/componentRenderUtils.ts index 5e60ad3975..a105ce987f 100644 --- a/packages/runtime-core/src/componentRenderUtils.ts +++ b/packages/runtime-core/src/componentRenderUtils.ts @@ -172,12 +172,20 @@ 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) { - const dynamicProps = nextVNode.dynamicProps! - for (let i = 0; i < dynamicProps.length; i++) { - const key = dynamicProps[i] - if (nextProps![key] !== prevProps![key]) { - return true + } 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] + if (nextProps![key] !== prevProps![key]) { + return true + } } } }