From: underfin Date: Thu, 15 Oct 2020 15:05:12 +0000 (+0800) Subject: fix(hmr): full diff props for non-sfc component (#2359) X-Git-Tag: v3.0.1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e78915a74045ebcf34e8e99064fff48cd044632c;p=thirdparty%2Fvuejs%2Fcore.git fix(hmr): full diff props for non-sfc component (#2359) close #https://github.com/vitejs/vite/issues/872 --- diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index 9fc2ac78b8..938318d4a9 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -156,8 +156,14 @@ export function updateProps( const [options] = instance.propsOptions if ( - // always force full diff if hmr is enabled - !(__DEV__ && instance.type.__hmrId) && + // 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)) + ) && (optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS) ) {