Skip to content

Commit fd7883d

Browse files
committed
fix(hmr): properly force hmr full component which uses directives props update
1 parent 327c898 commit fd7883d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

packages/runtime-core/src/componentProps.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,19 @@ 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
191+
}
192+
}
193+
181194
export function updateProps(
182195
instance: ComponentInternalInstance,
183196
rawProps: Data | null,
@@ -197,11 +210,7 @@ export function updateProps(
197210
// always force full diff in dev
198211
// - #1942 if hmr is enabled with sfc component
199212
// - vite#872 non-sfc component used by sfc component
200-
!(
201-
__DEV__ &&
202-
(instance.type.__hmrId ||
203-
(instance.parent && instance.parent.type.__hmrId))
204-
) &&
213+
!(__DEV__ && inHmrContext(instance)) &&
205214
(optimized || patchFlag > 0) &&
206215
!(patchFlag & PatchFlags.FULL_PROPS)
207216
) {

0 commit comments

Comments
 (0)