From 2ffa4dfd436e7bcd5063acb5e150b522bc62afc7 Mon Sep 17 00:00:00 2001 From: Kezhik Kyzyl-ool Date: Mon, 26 Feb 2024 18:56:39 +0100 Subject: [PATCH 1/2] feat: overriding existing default meta --- src/render.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/render.ts b/src/render.ts index 701abc6..c068eb3 100644 --- a/src/render.ts +++ b/src/render.ts @@ -39,7 +39,13 @@ export function generateRenderContent( ): RenderContent { const helpers = getRenderHelpers(params); const htmlAttributes: Record = {}; - const meta = [...defaultMeta, ...(params.meta ?? [])]; + const meta = params.meta ?? []; + defaultMeta.forEach((defaultMetaItem) => { + if (!meta.find(({name}) => name === defaultMetaItem.name)) { + meta.push(defaultMetaItem); + } + }); + // in terms of sets: meta = params.meta ∪ (defaultMeta ∖ params.meta) const styleSheets = params.styleSheets || []; const scripts = params.scripts || []; const inlineStyleSheets = params.inlineStyleSheets || []; From 0d1d95c9547bb54a6bb09713061cdaa1a4b96e46 Mon Sep 17 00:00:00 2001 From: Kyzyl-ool Kezhik Date: Tue, 27 Feb 2024 11:37:29 +0100 Subject: [PATCH 2/2] Update src/render.ts Co-authored-by: Valerii Sidorenko --- src/render.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render.ts b/src/render.ts index c068eb3..e6f8e35 100644 --- a/src/render.ts +++ b/src/render.ts @@ -40,12 +40,12 @@ export function generateRenderContent( const helpers = getRenderHelpers(params); const htmlAttributes: Record = {}; const meta = params.meta ?? []; + // in terms of sets: meta = params.meta ∪ (defaultMeta ∖ params.meta) defaultMeta.forEach((defaultMetaItem) => { if (!meta.find(({name}) => name === defaultMetaItem.name)) { meta.push(defaultMetaItem); } }); - // in terms of sets: meta = params.meta ∪ (defaultMeta ∖ params.meta) const styleSheets = params.styleSheets || []; const scripts = params.scripts || []; const inlineStyleSheets = params.inlineStyleSheets || [];