From f7318e9b88814166cac0811230600a3c72a61b26 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 23 May 2021 21:55:40 +0800 Subject: [PATCH 1/2] fix(hmr): always full diff props in dev --- packages/runtime-core/src/componentProps.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index d86eb969894..452c9fac616 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -195,11 +195,7 @@ export function updateProps( // always force full diff in dev // - #1942 if hmr is enabled with sfc component // - vite#872 non-sfc component used by sfc component - !( - __DEV__ && - (instance.type.__hmrId || - (instance.parent && instance.parent.type.__hmrId)) - ) && + !__DEV__ && (optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS) ) { From 7778734120ada1d0f64fb7774d44ceab0aedec2e Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 25 May 2021 12:02:33 +0800 Subject: [PATCH 2/2] fix(hmr): check hmr updating state before full diff props --- packages/runtime-core/src/componentProps.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index 452c9fac616..3d16a614d4f 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -38,6 +38,7 @@ import { createPropsDefaultThis } from './compat/props' import { isCompatEnabled, softAssertCompatEnabled } from './compat/compatConfig' import { DeprecationTypes } from './compat/compatConfig' import { shouldSkipAttr } from './compat/attrsFallthrough' +import { isHmrUpdating } from './hmr' export type ComponentPropsOptions

= | ComponentObjectPropsOptions

@@ -195,7 +196,7 @@ export function updateProps( // always force full diff in dev // - #1942 if hmr is enabled with sfc component // - vite#872 non-sfc component used by sfc component - !__DEV__ && + !(__DEV__ && isHmrUpdating) && (optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS) ) {