ソースを参照

chore(runtime-vapor): clarify KeepAlive same-tick teardown fallback

daiwei 2 ヶ月 前
コミット
3f95dadcc2
1 ファイル変更4 行追加0 行削除
  1. 4 0
      packages/runtime-vapor/src/components/KeepAlive.ts

+ 4 - 0
packages/runtime-vapor/src/components/KeepAlive.ts

@@ -353,6 +353,10 @@ const VaporKeepAliveImpl = defineVaporComponent({
         remove(cached, storageContainer)
         remove(cached, storageContainer)
       })
       })
 
 
+      // Same-tick branch switches can tear down KeepAlive after the next branch
+      // has already been marked with COMPONENT_SHOULD_KEEP_ALIVE in
+      // processShapeFlag(), but before cacheBlock() stores it in cache.
+      // That current live block still needs the current-entry deactivation path.
       if (!matched && currentBlock && isKeptAlive(currentBlock, interop)) {
       if (!matched && currentBlock && isKeptAlive(currentBlock, interop)) {
         deactivateCached(currentBlock)
         deactivateCached(currentBlock)
       }
       }