Skip to content

Commit 39ca181

Browse files
committed
fix(hmr): ensure unregisterHMR is called to avoid stale instances during reload
1 parent fc98351 commit 39ca181

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/runtime-core/src/hmr.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ function reload(id: string, newComp: HMRComponent): void {
172172
isHmrUpdating = true
173173
const parent = instance.parent! as ComponentInternalInstance
174174
if (parent.vapor) {
175+
// ensure unregisterHMR is called to avoid stale instances
176+
instance.scope.stop()
175177
parent.hmrRerender!()
176178
} else {
177179
if (!(parent.effect.flags! & EffectFlags.STOP)) {

packages/runtime-vapor/src/hmr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function hmrReload(
3838
): void {
3939
// if parent is KeepAlive, we need to rerender it
4040
if (instance.parent && isKeepAlive(instance.parent)) {
41+
instance.scope.stop()
4142
instance.parent.hmrRerender!()
4243
return
4344
}

0 commit comments

Comments
 (0)