Skip to content

Commit 68809eb

Browse files
authored
Update componentProps.ts
1 parent fd7883d commit 68809eb

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

packages/runtime-core/src/componentProps.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,10 @@ export function initProps(
178178
instance.attrs = attrs
179179
}
180180

181-
function inHmrContext(instance: ComponentInternalInstance) {
182-
if (instance.type.__hmrId) {
183-
return instance.type.__hmrId
184-
}
185-
let parent = instance.parent
186-
while (parent) {
187-
if (parent.type.__file) {
188-
return parent.type.__hmrId
189-
}
190-
parent = parent.parent
181+
function isInHmrContext(instance: ComponentInternalInstance | null) {
182+
while (instance) {
183+
if (instance.type.__hmrId) return true
184+
instance = instance.parent
191185
}
192186
}
193187

@@ -210,7 +204,7 @@ export function updateProps(
210204
// always force full diff in dev
211205
// - #1942 if hmr is enabled with sfc component
212206
// - vite#872 non-sfc component used by sfc component
213-
!(__DEV__ && inHmrContext(instance)) &&
207+
!(__DEV__ && isInHmrContext(instance)) &&
214208
(optimized || patchFlag > 0) &&
215209
!(patchFlag & PatchFlags.FULL_PROPS)
216210
) {

0 commit comments

Comments
 (0)