Skip to content

Commit 0c65dc4

Browse files
committed
fix: custom tag vars should be a let
1 parent d1bd987 commit 0c65dc4

File tree

17 files changed

+28
-22
lines changed
  • .changeset
  • packages/runtime-tags/src
    • __tests__/fixtures
      • cross-tag-closure/__snapshots__/html.expected
      • custom-tag-var-assignment/__snapshots__/html.expected
      • custom-tag-var-expression/__snapshots__/html.expected
      • custom-tag-var-intersection/__snapshots__/html.expected
      • custom-tag-var-multiple/__snapshots__/html.expected
      • custom-tag-var/__snapshots__/html.expected
      • dynamic-tag-var/__snapshots__/html.expected
      • hoist-custom-tag-var-attr-tag/__snapshots__/html.expected
      • hoist-custom-tag-var-from-dynamic/__snapshots__/html.expected
      • hoist-custom-tag-var-many/__snapshots__/html.expected
      • hoist-custom-tag-var/__snapshots__/html.expected
      • html-comment-var/__snapshots__/html.expected
      • no-render-content-conditional/__snapshots__/html.expected/tags
      • no-render-content-subtree/__snapshots__/html.expected/tags
      • return-tag-no-state/__snapshots__/html.expected
    • translator/visitors/tag

17 files changed

+28
-22
lines changed

.changeset/great-lands-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@marko/runtime-tags": patch
3+
---
4+
5+
Fix issue where custom tags were incorrectly outputting tag variables as a const in ssr.

packages/runtime-tags/src/__tests__/fixtures/cross-tag-closure/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
55
const $scope0_id = _$.nextScopeId();
66
const $count_closures = new Set();
77
const $childScope = _$.peekNextScopeId();
8-
const count = _myLet({
8+
let count = _myLet({
99
value: 0
1010
});
1111
_$.setTagVar($scope0_id, "#scopeOffset/1", $childScope, "__tests__/template.marko_0_count/var");

packages/runtime-tags/src/__tests__/fixtures/custom-tag-var-assignment/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
33
export default _$.createTemplate("__tests__/template.marko", input => {
44
const $scope0_id = _$.nextScopeId();
55
const $childScope = _$.peekNextScopeId();
6-
const count = _counter({});
6+
let count = _counter({});
77
_$.setTagVar($scope0_id, "#scopeOffset/1", $childScope, "__tests__/template.marko_0_count/var");
88
_$.write(`<button class=inc-parent>${_$.escapeXML(count)}${_$.markResumeNode($scope0_id, "#text/3")}</button>${_$.markResumeNode($scope0_id, "#button/2")}<button class=reset>reset</button>${_$.markResumeNode($scope0_id, "#button/4")}`);
99
_$.writeEffect($scope0_id, "__tests__/template.marko_0");

packages/runtime-tags/src/__tests__/fixtures/custom-tag-var-expression/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
33
export default _$.createTemplate("__tests__/template.marko", input => {
44
const $scope0_id = _$.nextScopeId();
55
const $childScope = _$.peekNextScopeId();
6-
const data = _child({});
6+
let data = _child({});
77
_$.setTagVar($scope0_id, "#scopeOffset/1", $childScope, "__tests__/template.marko_0_data/var");
88
_$.write(`<div>${_$.escapeXML(data)}${_$.markResumeNode($scope0_id, "#text/2")}</div>`);
99
_$.writeScope($scope0_id, {

packages/runtime-tags/src/__tests__/fixtures/custom-tag-var-intersection/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
44
const $scope0_id = _$.nextScopeId();
55
let name = "Marko";
66
const $childScope = _$.peekNextScopeId();
7-
const data = _child({
7+
let data = _child({
88
extra: 1
99
});
1010
_$.setTagVar($scope0_id, "#scopeOffset/1", $childScope, "__tests__/template.marko_0_data/var");

packages/runtime-tags/src/__tests__/fixtures/custom-tag-var-multiple/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
33
export default _$.createTemplate("__tests__/template.marko", input => {
44
const $scope0_id = _$.nextScopeId();
55
const $childScope = _$.peekNextScopeId();
6-
const data = _child({});
6+
let data = _child({});
77
_$.setTagVar($scope0_id, "#scopeOffset/1", $childScope, "__tests__/template.marko_0_data/var");
88
_$.write(`<div>${_$.escapeXML(data)}${_$.markResumeNode($scope0_id, "#text/2")}</div>`);
99
_$.writeScope($scope0_id, {

packages/runtime-tags/src/__tests__/fixtures/custom-tag-var/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as _$ from "@marko/runtime-tags/debug/html";
33
export default _$.createTemplate("__tests__/template.marko", input => {
44
const $scope0_id = _$.nextScopeId();
55
const $childScope = _$.peekNextScopeId();
6-
const data = _child({});
6+
let data = _child({});
77
_$.setTagVar($scope0_id, "#scopeOffset/1", $childScope, "__tests__/template.marko_0_data/var");
88
_$.write(`<div>${_$.escapeXML(data)}${_$.markResumeNode($scope0_id, "#text/2")}</div>`);
99
_$.writeScope($scope0_id, {

packages/runtime-tags/src/__tests__/fixtures/dynamic-tag-var/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import child from "./tags/child/index.marko";
22
import * as _$ from "@marko/runtime-tags/debug/html";
33
export default _$.createTemplate("__tests__/template.marko", input => {
44
const $scope0_id = _$.nextScopeId();
5-
const data1 = child({});
5+
let data1 = child({});
66
const $inputshowchild_scope = _$.peekNextScopeId();
77
const data2 = _$.dynamicTag($scope0_id, "#text/2", input.show && child, {});
88
_$.setTagVar($scope0_id, "#scopeOffset/3", $inputshowchild_scope, "__tests__/template.marko_0_data2/var");

packages/runtime-tags/src/__tests__/fixtures/hoist-custom-tag-var-attr-tag/__snapshots__/html.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default _$.createTemplate("__tests__/template.marko", input => {
99
what: _$.attrTag({
1010
content: _$.registerContent("__tests__/template.marko_1_renderer", () => {
1111
const $scope1_id = _$.nextScopeId();
12-
const setHtml = _child({});
12+
let setHtml = _child({});
1313
_$.writeSubscribe($what_content_subscribers, _$.writeScope($scope1_id, {
1414
setHtml
1515
}, "__tests__/template.marko", "3:4", {

packages/runtime-tags/src/__tests__/fixtures/hoist-custom-tag-var-from-dynamic/__snapshots__/html.expected/template.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default _$.createTemplate("__tests__/template.marko", (input, $serialize)
1111
_thing({
1212
content: _$.createContent("__tests__/template.marko_1_renderer", () => {
1313
const $scope1_id = _$.nextScopeId();
14-
const setHtml = _child({});
14+
let setHtml = _child({});
1515
_$.writeSubscribe($thing_content_subscribers, _$.writeScope($scope1_id, {
1616
setHtml
1717
}, "__tests__/template.marko", "3:2", {
@@ -25,7 +25,7 @@ export default _$.createTemplate("__tests__/template.marko", (input, $serialize)
2525
_thing({
2626
content: _$.createContent("__tests__/template.marko_3_renderer", () => {
2727
const $scope3_id = _$.nextScopeId();
28-
const setHtml2 = _child({});
28+
let setHtml2 = _child({});
2929
_$.writeSubscribe($thing_content2_subscribers, _$.writeScope($scope3_id, {
3030
setHtml2
3131
}, "__tests__/template.marko", "16:4", {
@@ -39,7 +39,7 @@ export default _$.createTemplate("__tests__/template.marko", (input, $serialize)
3939
}, $scope0_id), 0, _$.serializeGuard($serialize, /* input.show */0));
4040
_$.dynamicTag($scope0_id, "#text/2", input.show ? 'section' : null, {}, _$.registerContent("__tests__/template.marko_4_renderer", () => {
4141
const $scope4_id = _$.nextScopeId();
42-
const setHtml3 = _child({});
42+
let setHtml3 = _child({});
4343
_$.writeSubscribe($inputshowsectionnull_content_subscribers, _$.writeScope($scope4_id, {
4444
setHtml3
4545
}, "__tests__/template.marko", "26:4", {

0 commit comments

Comments
 (0)