Skip to content

Commit 7acdc2c

Browse files
committed
fix: store section with scope reads
1 parent 59a90bf commit 7acdc2c

15 files changed

Lines changed: 185 additions & 37 deletions

File tree

.changeset/eager-rabbits-live.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 cases where compiler was not storing section information with scope reads.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"vars": {
3+
"props": {
4+
"$_": "t",
5+
"$init": "m",
6+
"$$getbutton": "o"
7+
}
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Render
2+
```html
3+
<button
4+
data-count="0"
5+
>
6+
after
7+
</button>
8+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Render
2+
```html
3+
<button
4+
data-count="0"
5+
>
6+
after
7+
</button>
8+
```
9+
10+
# Mutations
11+
```
12+
INSERT button
13+
REMOVE #text in button
14+
INSERT button/#text
15+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// size: 72 (min) 73 (brotli)
2+
const $getbutton = _._el("a0", 0);
3+
(_._script("a1", ($scope) => ($getbutton($scope)().textContent = "after")),
4+
init());
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const $template = "<button>Initial</button>";
2+
export const $walks = /* get, over(1) */" b";
3+
import * as _ from "@marko/runtime-tags/debug/dom";
4+
const $getbutton = _._el("__tests__/template.marko_0/#button", "#button/0");
5+
const $count = /* @__PURE__ */_._let("count/1", $scope => _._attr($scope["#button/0"], "data-count", $scope.count));
6+
const $setup__script = _._script("__tests__/template.marko_0", $scope => ((0, $getbutton($scope))().textContent = "after"));
7+
export function $setup($scope) {
8+
$count($scope, 0);
9+
$setup__script($scope);
10+
}
11+
export default /* @__PURE__ */_._template("__tests__/template.marko", $template, $walks, $setup);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as _ from "@marko/runtime-tags/debug/html";
2+
export default _._template("__tests__/template.marko", input => {
3+
const $scope0_id = _._scope_id();
4+
const btn = _._el($scope0_id, "__tests__/template.marko_0/#button");
5+
let count = 0;
6+
_._html(`<button${_._attr("data-count", count)}>Initial</button>${_._el_resume($scope0_id, "#button/0")}`);
7+
_._script($scope0_id, "__tests__/template.marko_0");
8+
_._scope($scope0_id, {}, "__tests__/template.marko", 0);
9+
_._resume_branch($scope0_id);
10+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Render
2+
```html
3+
<button
4+
data-count="0"
5+
>
6+
after
7+
</button>
8+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Render
2+
```html
3+
<html>
4+
<head />
5+
<body>
6+
<button
7+
data-count="0"
8+
>
9+
after
10+
</button>
11+
<!--M_*1 #button/0-->
12+
<script>
13+
WALKER_RUNTIME("M")("_");
14+
M._.r = [_ =&gt; (_.a = [0,
15+
{}]),
16+
"__tests__/template.marko_0 1"
17+
];
18+
M._.w()
19+
</script>
20+
</body>
21+
</html>
22+
```
23+
24+
# Mutations
25+
```
26+
REMOVE #text in html/body/button
27+
INSERT html/body/button/#text
28+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Render End
2+
```html
3+
<button
4+
data-count="0"
5+
>
6+
Initial
7+
</button>
8+
```

0 commit comments

Comments
 (0)