فهرست منبع

fix(hmr): fix hmr for components managed by keep-alive (#6809)

fix #6222
花果山大圣 3 سال پیش
والد
کامیت
bdaf83aae7
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      packages/runtime-core/src/components/KeepAlive.ts

+ 4 - 1
packages/runtime-core/src/components/KeepAlive.ts

@@ -31,6 +31,7 @@ import {
   invokeArrayFns
 } from '@vue/shared'
 import { watch } from '../apiWatch'
+import { hmrDirtyComponents } from '../hmr'
 import {
   RendererInternals,
   queuePostRenderEffect,
@@ -280,7 +281,9 @@ const KeepAliveImpl: ComponentOptions = {
 
       if (
         (include && (!name || !matches(include, name))) ||
-        (exclude && name && matches(exclude, name))
+        (exclude && name && matches(exclude, name)) ||
+        (__DEV__ && hmrDirtyComponents.has(comp))
+
       ) {
         current = vnode
         return rawVNode