From 343c89122448719bd6ed6bd9de986dfb2721d6bf Mon Sep 17 00:00:00 2001 From: yangxiuxiu <79584569+yangxiuxiu1115@users.noreply.github.com> Date: Tue, 13 May 2025 22:16:45 +0800 Subject: [PATCH] fix(transition): fix KeepAlive with transition out-in mode behavior in production (#12468) close #12465 --- .../components/BaseTransition.spec.ts | 47 +++++++++++++++++++ .../src/components/BaseTransition.ts | 5 +- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/packages/runtime-core/__tests__/components/BaseTransition.spec.ts b/packages/runtime-core/__tests__/components/BaseTransition.spec.ts index aaeae3fb4f..b40113fb5b 100644 --- a/packages/runtime-core/__tests__/components/BaseTransition.spec.ts +++ b/packages/runtime-core/__tests__/components/BaseTransition.spec.ts @@ -1198,4 +1198,51 @@ describe('BaseTransition', () => { test('should not error on KeepAlive w/ function children', () => { expect(() => mount({}, () => () => h('div'), true)).not.toThrow() }) + + // #12465 + test('mode: "out-in" w/ KeepAlive + fallthrough attrs (prod mode)', async () => { + __DEV__ = false + async function testOutIn({ trueBranch, falseBranch }: ToggleOptions) { + const toggle = ref(true) + const { props, cbs } = mockProps({ mode: 'out-in' }, true) + const root = nodeOps.createElement('div') + const App = { + render() { + return h( + BaseTransition, + { + ...props, + class: 'test', + }, + () => + h(KeepAlive, null, toggle.value ? trueBranch() : falseBranch()), + ) + }, + } + render(h(App), root) + + expect(serializeInner(root)).toBe(`