Skip to content

Commit 499bc0b

Browse files
committed
fix(hmr): properly force hmr full component props update
fix #1942
1 parent 57642fa commit 499bc0b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/runtime-core/src/componentProps.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,12 @@ export function updateProps(
153153
const rawCurrentProps = toRaw(props)
154154
const [options] = normalizePropsOptions(instance.type)
155155

156-
if ((optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS)) {
156+
if (
157+
// always force full diff if hmr is enabled
158+
!(__DEV__ && instance.type.__hmrId) &&
159+
(optimized || patchFlag > 0) &&
160+
!(patchFlag & PatchFlags.FULL_PROPS)
161+
) {
157162
if (patchFlag & PatchFlags.PROPS) {
158163
// Compiler-generated props & no keys change, just set the updated
159164
// the props.

packages/runtime-core/src/renderer.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1451,9 +1451,6 @@ function baseCreateRenderer(
14511451
nextVNode: VNode,
14521452
optimized: boolean
14531453
) => {
1454-
if (__DEV__ && instance.type.__hmrId) {
1455-
optimized = false
1456-
}
14571454
nextVNode.component = instance
14581455
const prevProps = instance.vnode.props
14591456
instance.vnode = nextVNode

0 commit comments

Comments
 (0)