From c8a18adf59db22b664fc5ad981c82700b67b3ea3 Mon Sep 17 00:00:00 2001 From: Anthony Catel Date: Thu, 10 Mar 2022 15:19:33 +0100 Subject: [PATCH 1/2] Fix: missing reserved prop ref_key, leading to unwanted property leak in SSR code generation. (fix #5563) --- packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts | 1 + packages/server-renderer/src/helpers/ssrRenderAttrs.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts b/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts index f3bcf8d3b93..7369975f5fb 100644 --- a/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts +++ b/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts @@ -15,6 +15,7 @@ describe('ssr: renderAttrs', () => { expect( ssrRenderAttrs({ key: 1, + ref_key: 'foo', ref: () => {}, onClick: () => {} }) diff --git a/packages/server-renderer/src/helpers/ssrRenderAttrs.ts b/packages/server-renderer/src/helpers/ssrRenderAttrs.ts index 8814f1fd735..5bac3ac472c 100644 --- a/packages/server-renderer/src/helpers/ssrRenderAttrs.ts +++ b/packages/server-renderer/src/helpers/ssrRenderAttrs.ts @@ -12,7 +12,7 @@ import { } from '@vue/shared' // leading comma for empty string "" -const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent`) +const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key`) export function ssrRenderAttrs( props: Record, From 471add9465f159c39fac4587fb40f8275bc71677 Mon Sep 17 00:00:00 2001 From: Anthony Catel Date: Thu, 10 Mar 2022 17:15:34 +0100 Subject: [PATCH 2/2] Also add ref_for --- packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts | 1 + packages/server-renderer/src/helpers/ssrRenderAttrs.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts b/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts index 7369975f5fb..62ccdb59974 100644 --- a/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts +++ b/packages/server-renderer/__tests__/ssrRenderAttrs.spec.ts @@ -16,6 +16,7 @@ describe('ssr: renderAttrs', () => { ssrRenderAttrs({ key: 1, ref_key: 'foo', + ref_for: 'bar', ref: () => {}, onClick: () => {} }) diff --git a/packages/server-renderer/src/helpers/ssrRenderAttrs.ts b/packages/server-renderer/src/helpers/ssrRenderAttrs.ts index 5bac3ac472c..147d08f0588 100644 --- a/packages/server-renderer/src/helpers/ssrRenderAttrs.ts +++ b/packages/server-renderer/src/helpers/ssrRenderAttrs.ts @@ -12,7 +12,7 @@ import { } from '@vue/shared' // leading comma for empty string "" -const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key`) +const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`) export function ssrRenderAttrs( props: Record,