mirror of https://github.com/vuejs/core.git
wip: handing teleport hmr updating
This commit is contained in:
parent
33830a0745
commit
098f50d5a1
|
@ -172,6 +172,13 @@ export function createComponent(
|
||||||
frag.hydrate()
|
frag.hydrate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (__DEV__) {
|
||||||
|
const instance = currentInstance as VaporComponentInstance
|
||||||
|
;(instance!.hmrEffects || (instance!.hmrEffects = [])).push(() =>
|
||||||
|
frag.remove(frag.anchor.parentNode!),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return frag as any
|
return frag as any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,6 +396,7 @@ export class VaporComponentInstance implements GenericComponentInstance {
|
||||||
devtoolsRawSetupState?: any
|
devtoolsRawSetupState?: any
|
||||||
hmrRerender?: () => void
|
hmrRerender?: () => void
|
||||||
hmrReload?: (newComp: VaporComponent) => void
|
hmrReload?: (newComp: VaporComponent) => void
|
||||||
|
hmrEffects?: (() => void)[]
|
||||||
propsOptions?: NormalizedPropsOptions
|
propsOptions?: NormalizedPropsOptions
|
||||||
emitsOptions?: ObjectEmitsOptions | null
|
emitsOptions?: ObjectEmitsOptions | null
|
||||||
isSingleRoot?: boolean
|
isSingleRoot?: boolean
|
||||||
|
|
|
@ -19,6 +19,10 @@ export function hmrRerender(instance: VaporComponentInstance): void {
|
||||||
const parent = normalized[0].parentNode!
|
const parent = normalized[0].parentNode!
|
||||||
const anchor = normalized[normalized.length - 1].nextSibling
|
const anchor = normalized[normalized.length - 1].nextSibling
|
||||||
remove(instance.block, parent)
|
remove(instance.block, parent)
|
||||||
|
if (instance.hmrEffects) {
|
||||||
|
instance.hmrEffects.forEach(e => e())
|
||||||
|
instance.hmrEffects.length = 0
|
||||||
|
}
|
||||||
const prev = currentInstance
|
const prev = currentInstance
|
||||||
simpleSetCurrentInstance(instance)
|
simpleSetCurrentInstance(instance)
|
||||||
pushWarningContext(instance)
|
pushWarningContext(instance)
|
||||||
|
@ -36,6 +40,10 @@ export function hmrReload(
|
||||||
const parent = normalized[0].parentNode!
|
const parent = normalized[0].parentNode!
|
||||||
const anchor = normalized[normalized.length - 1].nextSibling
|
const anchor = normalized[normalized.length - 1].nextSibling
|
||||||
unmountComponent(instance, parent)
|
unmountComponent(instance, parent)
|
||||||
|
if (instance.hmrEffects) {
|
||||||
|
instance.hmrEffects.forEach(e => e())
|
||||||
|
instance.hmrEffects.length = 0
|
||||||
|
}
|
||||||
const prev = currentInstance
|
const prev = currentInstance
|
||||||
simpleSetCurrentInstance(instance.parent)
|
simpleSetCurrentInstance(instance.parent)
|
||||||
const newInstance = createComponent(
|
const newInstance = createComponent(
|
||||||
|
|
Loading…
Reference in New Issue