From 4311dddfa72b405b20f469f8f219ec3027972f55 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 12 Apr 2022 15:06:46 +0800 Subject: [PATCH] fix(transition): ensure flattened transition group children inherit parent keys close #4718 close #5360 close #5392 --- .../src/components/BaseTransition.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/runtime-core/src/components/BaseTransition.ts b/packages/runtime-core/src/components/BaseTransition.ts index 27bfb5f5..c8a94594 100644 --- a/packages/runtime-core/src/components/BaseTransition.ts +++ b/packages/runtime-core/src/components/BaseTransition.ts @@ -164,7 +164,9 @@ const BaseTransitionImpl: ComponentOptions = { if ( __DEV__ && mode && - mode !== 'in-out' && mode !== 'out-in' && mode !== 'default' + mode !== 'in-out' && + mode !== 'out-in' && + mode !== 'default' ) { warn(`invalid mode: ${mode}`) } @@ -460,22 +462,28 @@ export function setTransitionHooks(vnode: VNode, hooks: TransitionHooks) { export function getTransitionRawChildren( children: VNode[], - keepComment: boolean = false + keepComment: boolean = false, + parentKey?: VNode['key'] ): VNode[] { let ret: VNode[] = [] let keyedFragmentCount = 0 for (let i = 0; i < children.length; i++) { - const child = children[i] + let child = children[i] + // #5360 inherit parent key in case of