@@ -39,6 +39,7 @@ import {
3939import { createElement } from '../dom/node'
4040import { type VaporFragment , isDynamicFragment , isFragment } from '../fragment'
4141import type { EffectScope } from '@vue/reactivity'
42+ import { isInteropEnabled } from '../vdominteropState'
4243
4344export interface VaporKeepAliveContext {
4445 processShapeFlag ( block : Block ) : boolean
@@ -154,7 +155,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
154155 keepAliveInstance . ctx = {
155156 getStorageContainer : ( ) => storageContainer ,
156157 getCachedComponent : ( comp , key ) => {
157- if ( isVNode ( comp ) ) {
158+ if ( isInteropEnabled && isVNode ( comp ) ) {
158159 return cache . get ( resolveKey ( comp . type , comp . key , currentBranchKey ) )
159160 }
160161 return cache . get ( resolveKey ( comp , key , currentBranchKey ) )
@@ -219,7 +220,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
219220 const [ innerBlock , interop ] = getInnerBlock ( block )
220221 if ( ! innerBlock || ! shouldCache ( innerBlock ! , props , interop ) ) return false
221222
222- if ( interop ) {
223+ if ( interop && isInteropEnabled ) {
223224 const cacheKey = getCacheKey ( innerBlock , true , currentBranchKey )
224225 if ( cache . has ( cacheKey ) ) {
225226 innerBlock . vnode ! . shapeFlag ! |= ShapeFlags . COMPONENT_KEPT_ALIVE
@@ -228,9 +229,11 @@ const VaporKeepAliveImpl = defineVaporComponent({
228229 } else {
229230 const cacheKey = getCacheKey ( innerBlock , false , currentBranchKey )
230231 if ( cache . has ( cacheKey ) ) {
231- innerBlock ! . shapeFlag ! |= ShapeFlags . COMPONENT_KEPT_ALIVE
232+ ; ( innerBlock as VaporComponentInstance ) ! . shapeFlag ! |=
233+ ShapeFlags . COMPONENT_KEPT_ALIVE
232234 }
233- innerBlock ! . shapeFlag ! |= ShapeFlags . COMPONENT_SHOULD_KEEP_ALIVE
235+ ; ( innerBlock as VaporComponentInstance ) ! . shapeFlag ! |=
236+ ShapeFlags . COMPONENT_SHOULD_KEEP_ALIVE
234237 }
235238 return true
236239 }
@@ -352,7 +355,7 @@ const shouldCache = (
352355) => {
353356 const isAsync = ! interop && isAsyncWrapper ( block as GenericComponentInstance )
354357 const type = (
355- interop
358+ interop && isInteropEnabled
356359 ? ( block as VaporFragment ) . vnode ! . type
357360 : ( block as GenericComponentInstance ) . type
358361 ) as GenericComponent & AsyncComponentInternalOptions
@@ -376,7 +379,7 @@ const resetCachedShapeFlag = (
376379) => {
377380 if ( isVaporComponent ( cached ) ) {
378381 resetShapeFlag ( cached )
379- } else {
382+ } else if ( isInteropEnabled ) {
380383 resetShapeFlag ( cached . vnode )
381384 }
382385}
@@ -405,7 +408,7 @@ function getCacheKey(
405408 interop : boolean ,
406409 branchKey ?: any ,
407410) : CacheKey {
408- if ( interop ) {
411+ if ( interop && isInteropEnabled ) {
409412 const frag = block as VaporFragment
410413 return resolveKey (
411414 frag . vnode ! . type ,
@@ -420,7 +423,7 @@ function getCacheKey(
420423function getInnerBlock ( block : Block ) : InnerBlockResult {
421424 if ( isVaporComponent ( block ) ) {
422425 return [ block , false ]
423- } else if ( isInteropFragment ( block ) ) {
426+ } else if ( isInteropEnabled && isInteropFragment ( block ) ) {
424427 return [ block , true ]
425428 } else if ( isFragment ( block ) ) {
426429 return getInnerBlock ( block . nodes )
@@ -434,12 +437,14 @@ function isInteropFragment(block: Block): block is VaporFragment {
434437
435438function getInstanceFromCache (
436439 cached : VaporComponentInstance | VaporFragment ,
437- ) : GenericComponentInstance {
440+ ) : GenericComponentInstance | undefined {
438441 if ( isVaporComponent ( cached ) ) {
439442 return cached
440443 }
441444 // vdom interop
442- return cached . vnode ! . component as GenericComponentInstance
445+ if ( isInteropEnabled ) {
446+ return cached . vnode ! . component as GenericComponentInstance
447+ }
443448}
444449
445450export function activate (
0 commit comments