diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index c4ab05dd021..4ac5c4c7867 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -178,6 +178,13 @@ export function initProps( instance.attrs = attrs } +function isInHmrContext(instance: ComponentInternalInstance | null) { + while (instance) { + if (instance.type.__hmrId) return true + instance = instance.parent + } +} + export function updateProps( instance: ComponentInternalInstance, rawProps: Data | null, @@ -197,11 +204,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__ && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS) ) {