Subscribe on changes!

pruneCache function why not use isAsyncWrapper to determine vnode is AsyncComponentWrapper

avatar
Oct 23rd 2023

Vue version

v3.3.6

Link to minimal reproduction

v3.3.6

Steps to reproduce

   function pruneCache(filter?: (name: string) => boolean) {
      cache.forEach((vnode, key) => {
        const name = getComponentName(vnode.type as ConcreteComponent)
        if (name && (!filter || !filter(name))) {
          pruneCacheEntry(key)
        }
      })
    }

What is expected?

   function pruneCache(filter?: (name: string) => boolean) {
      cache.forEach((vnode, key) => {
       const name = getComponentName(isAsyncWrapper(vnode)
                ? vnode.type.__asyncResolved || {}
                : comp);
        if (name && (!filter || !filter(name))) {
          pruneCacheEntry(key)
        }
      })
    }

What is actually happening?

when you change include ,AsyncComponentWrappers will unmount,but i don't want to unmount.

System Info

No response

Any additional comments?

No response

avatar
Oct 23rd 2023

Please provide a valid reproduction showing the problem you are facing instead of directly jumping to suggested code changes. We can't determine whether it is the right fix without the context.

Closing - please open a new issue if you can provide a valid reproduction as required.