]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: save
authordaiwei <daiwei521@126.com>
Wed, 26 Mar 2025 13:09:15 +0000 (21:09 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 26 Mar 2025 13:09:15 +0000 (21:09 +0800)
packages/runtime-vapor/src/components/Teleport.ts
packages/runtime-vapor/src/hmr.ts

index ab900951da6e7e44549e8869314f0fa9fcbe973d..040914ef984b80fcddd4664e67a91cbc0ccb7342 100644 (file)
@@ -25,18 +25,20 @@ import { renderEffect } from '../renderEffect'
 import { extend, isArray } from '@vue/shared'
 import { EffectScope, pauseTracking, resetTracking } from '@vue/reactivity'
 
-export const teleportStack: TeleportFragment[] = []
+export const teleportStack: TeleportFragment[] = __DEV__
+  ? ([] as TeleportFragment[])
+  : (undefined as any)
 export const instanceToTeleportMap: WeakMap<
   VaporComponentInstance,
   TeleportFragment
-> = __DEV__ ? new WeakMap() : (null as any)
+> = __DEV__ ? new WeakMap() : (undefined as any)
 
 /**
  * dev only.
- * when the **root** child component updates, synchronously update
+ * when the root child component updates, synchronously update
  * the TeleportFragment's children and nodes.
  */
-export function handleTeleportChildrenHmrReload(
+export function handleTeleportRootComponentHmrReload(
   instance: VaporComponentInstance,
   newInstance: VaporComponentInstance,
 ): void {
index ba669360491c2e71775a6e4fbc9fc1f8f4aa1dc2..d72800cf53e36510569e4621112b9ed339424e87 100644 (file)
@@ -13,7 +13,7 @@ import {
   mountComponent,
   unmountComponent,
 } from './component'
-import { handleTeleportChildrenHmrReload } from './components/Teleport'
+import { handleTeleportRootComponentHmrReload } from './components/Teleport'
 
 export function hmrRerender(instance: VaporComponentInstance): void {
   const normalized = normalizeBlock(instance.block)
@@ -55,5 +55,5 @@ export function hmrReload(
   )
   simpleSetCurrentInstance(prev, instance.parent)
   mountComponent(newInstance, parent, anchor)
-  handleTeleportChildrenHmrReload(instance, newInstance)
+  handleTeleportRootComponentHmrReload(instance, newInstance)
 }