From 57a548c215d276ab2ffcd2184a5ddf9558ca47b2 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Fri, 12 Jan 2024 10:12:51 +0100 Subject: [PATCH] fix: support snippets with multiple arguments --- .../svelte2tsx/src/htmlxtojsx_v2/nodes/RenderTag.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/RenderTag.ts b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/RenderTag.ts index ee6efeda8..ccc286988 100644 --- a/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/RenderTag.ts +++ b/packages/svelte2tsx/src/htmlxtojsx_v2/nodes/RenderTag.ts @@ -9,12 +9,12 @@ export function handleRenderTag(str: MagicString, renderTag: BaseNode): void { str.overwrite(renderTag.start, renderTag.expression.start, ';__sveltets_2_ensureSnippet(', { contentOnly: true }); - if (renderTag.argument) { - str.overwrite( - withTrailingPropertyAccess(str.original, renderTag.argument.end), - renderTag.end, - '));' - ); + + // argument was present until https://github.com/sveltejs/svelte/pull/9988, remove at some point + const arg = renderTag.argument || renderTag.arguments?.[renderTag.arguments.length - 1]; + + if (arg) { + str.overwrite(withTrailingPropertyAccess(str.original, arg.end), renderTag.end, '));'); } else { str.overwrite( withTrailingPropertyAccess(str.original, renderTag.expression.end),