From c079c07f09abbc60258714db98330b8c50c3a64e Mon Sep 17 00:00:00 2001 From: Valentin Yushkevich Date: Tue, 24 Nov 2026 12:41:41 +0300 Subject: [PATCH 1/2] fix(hydration): unwrap cached children in production close #16427 --- .../runtime-core/__tests__/hydration.spec.ts | 29 +++++++++++++++++++ packages/runtime-core/src/hydration.ts | 5 +++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/__tests__/hydration.spec.ts b/packages/runtime-core/__tests__/hydration.spec.ts index 042f1a735c6..ede50055bd2 100644 --- a/packages/runtime-core/__tests__/hydration.spec.ts +++ b/packages/runtime-core/__tests__/hydration.spec.ts @@ -3325,6 +3325,35 @@ describe('SSR hydration', () => { expect(`mismatch`).not.toHaveBeenWarned() }) + // #16427 + test('transition appear with cached static child in prod', () => { + __DEV__ = false + try { + const { vnode, container } = mountWithHydration( + ``, + () => + h( + Transition, + { appear: true }, + { + default: () => + createElementVNode('div', null, 'foo', PatchFlags.CACHED), + }, + ), + ) + expect(container.firstChild).toMatchInlineSnapshot(` +
+ foo +
+ `) + expect(vnode.el).toBe(container.firstChild) + } finally { + __DEV__ = true + } + }) + test('transition appear w/ event listener', async () => { const container = document.createElement('div') container.innerHTML = `` diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index 6a723569ef5..7c27351ae83 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -406,11 +406,14 @@ export function createHydrationFunctions( const hasDynamicProps = !!dynamicProps // skip props & children if this is hoisted static nodes // #5405 in dev, always hydrate children for HMR + // #16427 a cached child of still needs to be + // unwrapped from the SSR