Skip to content

Commit

Permalink
fix(hmr): properly force hmr full component props update
Browse files Browse the repository at this point in the history
fix #1942
  • Loading branch information
yyx990803 committed Aug 24, 2020
1 parent 57642fa commit 499bc0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/runtime-core/src/componentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ export function updateProps(
const rawCurrentProps = toRaw(props)
const [options] = normalizePropsOptions(instance.type)

if ((optimized || patchFlag > 0) && !(patchFlag & PatchFlags.FULL_PROPS)) {
if (
// always force full diff if hmr is enabled
!(__DEV__ && instance.type.__hmrId) &&
(optimized || patchFlag > 0) &&
!(patchFlag & PatchFlags.FULL_PROPS)
) {
if (patchFlag & PatchFlags.PROPS) {
// Compiler-generated props & no keys change, just set the updated
// the props.
Expand Down
3 changes: 0 additions & 3 deletions packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1451,9 +1451,6 @@ function baseCreateRenderer(
nextVNode: VNode,
optimized: boolean
) => {
if (__DEV__ && instance.type.__hmrId) {
optimized = false
}
nextVNode.component = instance
const prevProps = instance.vnode.props
instance.vnode = nextVNode
Expand Down

0 comments on commit 499bc0b

Please sign in to comment.