Skip to content

Commit e78915a

Browse files
authored
fix(hmr): full diff props for non-sfc component (#2359)
close #vitejs/vite#872
1 parent c6443a4 commit e78915a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/runtime-core/src/componentProps.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,14 @@ export function updateProps(
156156
const [options] = instance.propsOptions
157157

158158
if (
159-
// always force full diff if hmr is enabled
160-
!(__DEV__ && instance.type.__hmrId) &&
159+
// always force full diff in dev
160+
// - #1942 if hmr is enabled with sfc component
161+
// - vite#872 non-sfc component used by sfc component
162+
!(
163+
__DEV__ &&
164+
(instance.type.__hmrId ||
165+
(instance.parent && instance.parent.type.__hmrId))
166+
) &&
161167
(optimized || patchFlag > 0) &&
162168
!(patchFlag & PatchFlags.FULL_PROPS)
163169
) {

0 commit comments

Comments
 (0)