Skip to content

Commit

Permalink
fix: support snippets with multiple arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Jan 12, 2024
1 parent e9afe90 commit 57a548c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/svelte2tsx/src/htmlxtojsx_v2/nodes/RenderTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 57a548c

Please sign in to comment.