Browse Source

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

daiwei 1 month ago
parent
commit
3f95dadcc2
1 changed files with 4 additions and 0 deletions
  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)
       })
 
+      // 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)) {
         deactivateCached(currentBlock)
       }