Skip to content

Commit

Permalink
Update componentProps.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 30, 2022
1 parent fd7883d commit 68809eb
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/runtime-core/src/componentProps.ts
Expand Up @@ -178,16 +178,10 @@ export function initProps(
instance.attrs = attrs
}

function inHmrContext(instance: ComponentInternalInstance) {
if (instance.type.__hmrId) {
return instance.type.__hmrId
}
let parent = instance.parent
while (parent) {
if (parent.type.__file) {
return parent.type.__hmrId
}
parent = parent.parent
function isInHmrContext(instance: ComponentInternalInstance | null) {
while (instance) {
if (instance.type.__hmrId) return true
instance = instance.parent
}
}

Expand All @@ -210,7 +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__ && inHmrContext(instance)) &&
!(__DEV__ && isInHmrContext(instance)) &&
(optimized || patchFlag > 0) &&
!(patchFlag & PatchFlags.FULL_PROPS)
) {
Expand Down

0 comments on commit 68809eb

Please sign in to comment.