fix(hmr): properly force hmr full component props update

fix #1942
This commit is contained in:
Evan You 2020-08-24 18:13:17 -04:00
parent 57642fac8f
commit 499bc0bfc4
2 changed files with 6 additions and 4 deletions

View File

@ -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.

View File

@ -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