Skip to content

Commit 742fca5

Browse files
committed
feat: allow reading tag variables after they are written
1 parent 064f068 commit 742fca5

File tree

256 files changed

+971
-440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+971
-440
lines changed

.changeset/few-views-kneel.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+
Allow reading proposed tag variable value after writing.

.sizes.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@
4444
{
4545
"name": "comments",
4646
"user": {
47-
"min": 891,
48-
"brotli": 455
47+
"min": 893,
48+
"brotli": 458
4949
},
5050
"runtime": {
5151
"min": 7019,
5252
"brotli": 3005
5353
},
5454
"total": {
55-
"min": 7910,
56-
"brotli": 3460
55+
"min": 7912,
56+
"brotli": 3463
5757
}
5858
},
5959
{
6060
"name": "comments 💧",
6161
"user": {
62-
"min": 140,
63-
"brotli": 119
62+
"min": 142,
63+
"brotli": 123
6464
},
6565
"runtime": {
6666
"min": 2355,
6767
"brotli": 1202
6868
},
6969
"total": {
70-
"min": 2495,
71-
"brotli": 1321
70+
"min": 2497,
71+
"brotli": 1325
7272
}
7373
}
7474
]

.sizes/comments.csr/entry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// size: 891 (min) 455 (brotli)
1+
// size: 893 (min) 458 (brotli)
22
const $setup$if$content = ($scope) => {
33
($scope[0],
44
$comment_comments$if$content._($scope),
@@ -37,7 +37,7 @@ const $setup$if$content = ($scope) => {
3737
$i$for$content = value(9, $expr_input_path_i$for$content),
3838
$open$for$content_effect = effect("a0", ($scope, { 12: open }) =>
3939
on($scope[2], "click", function () {
40-
$open$for$content($scope, !open);
40+
$open$for$content($scope, (open = !open));
4141
}),
4242
),
4343
$open$for$content = state(12, ($scope, open) => {

.sizes/comments.ssr/entry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// size: 140 (min) 119 (brotli)
1+
// size: 142 (min) 123 (brotli)
22
const $open$for$content_effect = effect("a0", ($scope, { 12: open }) =>
33
on($scope[2], "click", function () {
4-
$open$for$content($scope, !open);
4+
$open$for$content($scope, (open = !open));
55
}),
66
),
77
$open$for$content = state(12, ($scope, open) => {

.sizes/counter.csr/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// size: 184 (min) 151 (brotli)
22
const $clickCount_effect = effect("a0", ($scope, { 2: clickCount }) =>
33
on($scope[0], "click", function () {
4-
$clickCount($scope, clickCount + 1);
4+
$clickCount($scope, ++clickCount);
55
}),
66
),
77
$clickCount = state(2, ($scope, clickCount) => {

.sizes/counter.ssr/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// size: 106 (min) 97 (brotli)
22
const $clickCount_effect = effect("a0", ($scope, { 2: clickCount }) =>
33
on($scope[0], "click", function () {
4-
$clickCount($scope, clickCount + 1);
4+
$clickCount($scope, ++clickCount);
55
}),
66
),
77
$clickCount = state(2, ($scope, clickCount) => {

packages/runtime-tags/src/__tests__/fixtures/assignment-before-tag-var/__snapshots__/dom.expected/template.hydrate.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// size: 162 (min) 122 (brotli)
1+
// size: 162 (min) 123 (brotli)
22
const $clickCount_effect = _$.effect("a0", ($scope, { 3: clickCount }) =>
33
_$.on($scope[0], "click", function () {
4-
($lastClickCount($scope, clickCount),
5-
$clickCount($scope, clickCount + 1));
4+
($lastClickCount($scope, clickCount), $clickCount($scope, ++clickCount));
65
}),
76
),
87
$clickCount = _$.state(3, ($scope, clickCount) => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const $clickCount_effect = _$.effect("__tests__/template.marko_0_clickCount", ($
55
clickCount
66
}) => _$.on($scope["#button/0"], "click", function () {
77
$lastClickCount($scope, clickCount);
8-
$clickCount($scope, clickCount + 1), clickCount;
8+
$clickCount($scope, ++clickCount)
99
}));
1010
const $clickCount = /* @__PURE__ */_$.state("clickCount/3", ($scope, clickCount) => {
1111
_$.data($scope["#text/1"], clickCount);

packages/runtime-tags/src/__tests__/fixtures/async-state/__snapshots__/dom.expected/template.hydrate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const $await$try$content = _$.awaitTag(0, $await_content),
1515
$clickCount_closure = _$.dynamicClosure($clickCount$try$content),
1616
$clickCount_effect = _$.effect("a1", ($scope, { 2: clickCount }) =>
1717
_$.on($scope[0], "click", function () {
18-
$clickCount($scope, clickCount + 1);
18+
$clickCount($scope, ++clickCount);
1919
}),
2020
),
2121
$clickCount = _$.state(2, ($scope) => {

packages/runtime-tags/src/__tests__/fixtures/async-state/__snapshots__/dom.expected/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const $clickCount_closure = /* @__PURE__ */_$.dynamicClosure($clickCount$try$con
1515
const $clickCount_effect = _$.effect("__tests__/template.marko_0_clickCount", ($scope, {
1616
clickCount
1717
}) => _$.on($scope["#button/0"], "click", function () {
18-
$clickCount($scope, clickCount + 1), clickCount;
18+
$clickCount($scope, ++clickCount)
1919
}));
2020
const $clickCount = /* @__PURE__ */_$.state("clickCount/2", $scope => {
2121
$clickCount_closure($scope);

0 commit comments

Comments
 (0)