From bdaf83aae7b5651965870a0646da5ae4e5d96944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E6=9E=9C=E5=B1=B1=E5=A4=A7=E5=9C=A3?= <316783812@qq.com> Date: Tue, 8 Nov 2022 14:26:56 +0800 Subject: [PATCH] fix(hmr): fix hmr for components managed by keep-alive (#6809) fix #6222 --- packages/runtime-core/src/components/KeepAlive.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/components/KeepAlive.ts b/packages/runtime-core/src/components/KeepAlive.ts index 3fec48140fc..3bfef7bf9bf 100644 --- a/packages/runtime-core/src/components/KeepAlive.ts +++ b/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