From 34b5a5da4ae9c9faccac237acd7acc8e7e017571 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 10 Nov 2023 12:04:22 +0800 Subject: [PATCH 001/125] fix(hydration): properly hydrate indeterminate prop close #7476 --- packages/runtime-core/__tests__/hydration.spec.ts | 14 ++++++++++++++ packages/runtime-core/src/hydration.ts | 10 ++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/runtime-core/__tests__/hydration.spec.ts b/packages/runtime-core/__tests__/hydration.spec.ts index 50331d0623f..e54960222c4 100644 --- a/packages/runtime-core/__tests__/hydration.spec.ts +++ b/packages/runtime-core/__tests__/hydration.spec.ts @@ -953,6 +953,20 @@ describe('SSR hydration', () => { expect((container.firstChild as any)._trueValue).toBe(true) }) + test('force hydrate checkbox with indeterminate', () => { + const { container } = mountWithHydration( + '', + () => + createVNode( + 'input', + { type: 'checkbox', indeterminate: '' }, + null, + PatchFlags.HOISTED + ) + ) + expect((container.firstChild as any).indeterminate).toBe(true) + }) + test('force hydrate select option with non-string value bindings', () => { const { container } = mountWithHydration( '', diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index b8940e6679a..0e94495878e 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -321,23 +321,25 @@ export function createHydrationFunctions( const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode // #4006 for form elements with non-string v-model value bindings // e.g.