Skip to content

Commit e86be3b

Browse files
committed
chore: tweaks
1 parent a99b1ef commit e86be3b

File tree

1 file changed

+14
-3
lines changed
  • packages/runtime-vapor/src

1 file changed

+14
-3
lines changed

packages/runtime-vapor/src/hmr.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,20 @@ export function hmrReload(
4646
setCurrentInstance(...prev)
4747
mountComponent(newInstance, parent, anchor)
4848

49-
// update parentInstance.block to ensure that the correct parent and
50-
// anchor are found during parentInstance HMR rerender/reload, as
51-
// `normalizeBlock` relies on the current instance.block
49+
updateParentBlockOnHmrReload(parentInstance, instance, newInstance)
50+
}
51+
52+
/**
53+
* dev only
54+
* update parentInstance.block to ensure that the correct parent and
55+
* anchor are found during parentInstance HMR rerender/reload, as
56+
* `normalizeBlock` relies on the current instance.block
57+
*/
58+
function updateParentBlockOnHmrReload(
59+
parentInstance: VaporComponentInstance | null,
60+
instance: VaporComponentInstance,
61+
newInstance: VaporComponentInstance,
62+
): void {
5263
if (parentInstance) {
5364
if (parentInstance.block === instance) {
5465
parentInstance.block = newInstance

0 commit comments

Comments
 (0)