]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(hmr): properly force hmr full component props update
authorEvan You <yyx990803@gmail.com>
Mon, 24 Aug 2020 22:13:17 +0000 (18:13 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 24 Aug 2020 22:13:29 +0000 (18:13 -0400)
fix #1942

packages/runtime-core/src/componentProps.ts
packages/runtime-core/src/renderer.ts

index 90abf4149f04856854bc430e739c652239905476..28d7de2a5e727429e9457796029313aa8129ea8a 100644 (file)
@@ -153,7 +153,12 @@ export function updateProps(
   const rawCurrentProps = toRaw(props)
   const [options] = normalizePropsOptions(instance.type)
 
-  if ((optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS)) {
+  if (
+    // always force full diff if hmr is enabled
+    !(__DEV__ && instance.type.__hmrId) &&
+    (optimized || patchFlag > 0) &&
+    !(patchFlag & PatchFlags.FULL_PROPS)
+  ) {
     if (patchFlag & PatchFlags.PROPS) {
       // Compiler-generated props & no keys change, just set the updated
       // the props.
index f35435a1c6912ee46d2d10d67f8ef93b76046b8f..930464ebc61f906a7721c6134e618e01b526c459 100644 (file)
@@ -1451,9 +1451,6 @@ function baseCreateRenderer(
     nextVNode: VNode,
     optimized: boolean
   ) => {
-    if (__DEV__ && instance.type.__hmrId) {
-      optimized = false
-    }
     nextVNode.component = instance
     const prevProps = instance.vnode.props
     instance.vnode = nextVNode