diff --git a/src/compiler/code_generator.ts b/src/compiler/code_generator.ts index f29d6ce9..94cedbb9 100644 --- a/src/compiler/code_generator.ts +++ b/src/compiler/code_generator.ts @@ -1268,7 +1268,7 @@ export class CodeGenerator { if (this.target.loopLevel || !this.hasSafeContext) { ctxStr = generateId("ctx"); this.helpers.add("capture"); - this.define(ctxStr, `capture(ctx);`); + this.define(ctxStr, `capture(ctx)`); } const target = compileExpr(ast.target); const blockString = `component(Portal, {target: ${target},slots: {'default': {__render: ${name}, __ctx: ${ctxStr}}}}, key + \`${key}\`, node, ctx)`; diff --git a/tests/misc/__snapshots__/portal.test.ts.snap b/tests/misc/__snapshots__/portal.test.ts.snap index 026d62b1..738e9dc4 100644 --- a/tests/misc/__snapshots__/portal.test.ts.snap +++ b/tests/misc/__snapshots__/portal.test.ts.snap @@ -19,7 +19,7 @@ exports[`Portal Add and remove portals 1`] = ` for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`portalId\`] = v_block1[i1]; const key1 = ctx['portalId']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); c_block1[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1); @@ -47,7 +47,7 @@ exports[`Portal Add and remove portals on div 1`] = ` for (let i1 = 0; i1 < l_block1; i1++) { ctx[\`portalId\`] = v_block1[i1]; const key1 = ctx['portalId']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); c_block1[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } return list(c_block1); @@ -77,7 +77,7 @@ exports[`Portal Add and remove portals with t-foreach 1`] = ` ctx[\`portalId\`] = v_block1[i1]; const key1 = ctx['portalId']; let txt1 = ctx['portalId']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); const b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); c_block1[i1] = withKey(block2([txt1], [b6]), key1); } @@ -108,7 +108,7 @@ exports[`Portal Add and remove portals with t-foreach and destroy 1`] = ` ctx[\`portalId\`] = v_block1[i1]; const key1 = ctx['portalId']; let txt1 = ctx['portalId']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); const b6 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); c_block1[i1] = withKey(block2([txt1], [b6]), key1); } @@ -140,7 +140,7 @@ exports[`Portal Add and remove portals with t-foreach inside div 1`] = ` ctx[\`portalId\`] = v_block2[i1]; const key1 = ctx['portalId']; let txt1 = ctx['portalId']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); const b7 = component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx); c_block2[i1] = withKey(block3([txt1], [b7]), key1); } @@ -376,7 +376,7 @@ exports[`Portal conditional use of Portal with child and div 2`] = ` for (let i1 = 0; i1 < l_block2; i1++) { ctx[\`elem\`] = v_block2[i1]; const key1 = ctx['elem']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); c_block2[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } const b2 = list(c_block2); @@ -424,7 +424,7 @@ exports[`Portal conditional use of Portal with child and div, variation 2`] = ` for (let i1 = 0; i1 < l_block3; i1++) { ctx[\`elem\`] = v_block3[i1]; const key1 = ctx['elem']; - const ctx1 = capture(ctx);; + const ctx1 = capture(ctx); c_block3[i1] = withKey(component(Portal, {target: '#outside',slots: {'default': {__render: slot1, __ctx: ctx1}}}, key + \`__1__\${key1}\`, node, ctx), key1); } const b3 = list(c_block3);