Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .changeset/resume-branch-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@marko/runtime-tags": patch
---

Fix two resume bugs in control-flow branches: a client-created `<if>`/`<for>`/dynamic-tag branch could be orphaned from the branch tree (leaking effect/`onDestroy` cleanup) when its owner was driven only by input, and a bare `<await>` (no enclosing `<try>`) could throw a `HierarchyRequestError` when its promise re-resolved after resume.

The closest-branch link is now omitted when a branch's contents provably register no cleanup (no `$signal`/`<lifecycle>`, dynamic closure, `<await>`/`<try>`, or custom/dynamic tag), trimming resume data for purely presentational control flow.
4 changes: 2 additions & 2 deletions .sizes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{
"name": "*",
"total": {
"min": 23837,
"brotli": 8807
"min": 23891,
"brotli": 8858
}
},
{
Expand Down
19 changes: 11 additions & 8 deletions .sizes/dom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// size: 23837 (min) 8807 (brotli)
// size: 23891 (min) 8858 (brotli)
//#region packages/runtime-tags/dist/dom.mjs
let empty = [],
rest = Symbol(),
Expand Down Expand Up @@ -1616,13 +1616,16 @@ function _await_promise(nodeAccessor, params) {
i: 0,
c() {
if (--awaitCounter.i) return 1;
(tryBranch === scope[branchAccessor]
? scope[nodeAccessor].parentNode &&
scope[nodeAccessor].replaceWith(
scope[branchAccessor].S.parentNode,
)
: dismissPlaceholder(tryBranch),
queueEffect(tryBranch, runPendingEffects));
if (tryBranch === scope[branchAccessor]) {
let anchor = scope[nodeAccessor];
if (anchor.parentNode) {
let detachedParent = scope[branchAccessor].S.parentNode;
detachedParent === anchor.parentNode
? anchor.remove()
: anchor.replaceWith(detachedParent);
}
} else dismissPlaceholder(tryBranch);
queueEffect(tryBranch, runPendingEffects);
},
}),
scope[promiseAccessor] ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"template.marko.page.mjs": {
"total": {
"min": 921,
"brotli": 452
"brotli": 453
},
"files": {
"v:template.marko.hydrate-6.js": 104,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 49563,
"brotli": 14671
"brotli": 14672
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 68022,
"brotli": 21118
"min": 68068,
"brotli": 21137
},
"files": {
"components/custom-tag.marko": 1121,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 65782,
"brotli": 20201
"min": 65808,
"brotli": 20243
},
"files": {
"components/tags-counter.marko": 691,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67231,
"brotli": 20838
"min": 67268,
"brotli": 20832
},
"files": {
"components/class-counter.marko": 1028,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66817,
"brotli": 20584
"min": 66851,
"brotli": 20594
},
"files": {
"tags/components/hello-internal.marko": 941,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 65782,
"brotli": 20201
"min": 65808,
"brotli": 20243
},
"files": {
"components/tags-counter.marko": 691,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67549,
"brotli": 20983
"min": 67589,
"brotli": 20964
},
"files": {
"components/my-button.marko": 1048,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67184,
"brotli": 20787
"min": 67219,
"brotli": 20835
},
"files": {
"components/class-counter.marko": 1043,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66107,
"brotli": 20382
"min": 66131,
"brotli": 20394
},
"files": {
"components/tags-layout.marko": 912,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 65777,
"brotli": 20245
"min": 65803,
"brotli": 20248
},
"files": {
"components/tags-layout.marko": 758,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67655,
"brotli": 21011
"min": 67697,
"brotli": 20991
},
"files": {
"components/class-layout.marko": 1227,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66972,
"brotli": 20691
"min": 67003,
"brotli": 20703
},
"files": {
"components/my-button/component-browser.js": 457,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66135,
"brotli": 20397
"min": 66162,
"brotli": 20426
},
"files": {
"components/tags-layout.marko": 922,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 68010,
"brotli": 21162
"min": 68052,
"brotli": 21140
},
"files": {
"components/class-layout.marko": 1245,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 1983,
"brotli": 942
"brotli": 945
},
"child.mjs": {
"min": 366,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 1937,
"brotli": 928
"brotli": 929
},
"child.mjs": {
"min": 366,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50468,
"brotli": 14924
"brotli": 14941
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50451,
"brotli": 14925
"brotli": 14964
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50468,
"brotli": 14924
"brotli": 14930
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50797,
"brotli": 15038
"brotli": 15055
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dom": {
"template.marko.page.mjs": {
"min": 3259,
"brotli": 1579
"min": 3239,
"brotli": 1571
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var template_default = _template("__tests__/template.marko", (input) => {
writeScope($scope1_id, { _: _scope_with_id($scope0_id) }, "__tests__/template.marko", "2:2");
return 0;
}
}, $scope0_id, "#text/0", 1, 1, 1, 0, 1);
}, $scope0_id, "#text/0", 1, 1, 1, 0, 1, 1);
writeScope($scope0_id, {}, "__tests__/template.marko", 0);
_resume_branch($scope0_id);
}, 1);
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var template_default = _template("a", (input) => {
writeScope($scope1_id, { _: _scope_with_id($scope0_id) });
return 0;
}
}, $scope0_id, "a", 1, 1, 1, 0, 1);
}, $scope0_id, "a", 1, 1, 1, 0, 1, 1);
writeScope($scope0_id, {});
_resume_branch($scope0_id);
}, 1);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dom": {
"template.marko.page.mjs": {
"min": 5888,
"brotli": 2681
"min": 5877,
"brotli": 2679
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dom": {
"template.marko.page.mjs": {
"min": 7752,
"brotli": 3307
"min": 7806,
"brotli": 3318
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dom": {
"template.marko.page.mjs": {
"min": 9233,
"brotli": 3912
"min": 9287,
"brotli": 3933
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var hello_default = _template("__tests__/tags/hello/index.marko", (input) => {
const $scope1_id = _scope_id();
_dynamic_tag($scope1_id, "#text/0", item.content, {}, 0, 0, $sg__input_item);
_serialize_if($scope0_reason, 1) && writeScope($scope1_id, {}, "__tests__/tags/hello/index.marko", "1:1");
}, 0, $scope0_id, "#text/0", $sg__input_item, $sg__input_item, $sg__input_item);
}, 0, $scope0_id, "#text/0", $sg__input_item, $sg__input_item, $sg__input_item, 0, 0, 1);
_dynamic_tag($scope0_id, "#text/1", input.other, {}, 0, 0, _serialize_guard($scope0_reason, 2));
_serialize_if($scope0_reason, 0) && writeScope($scope0_id, {}, "__tests__/tags/hello/index.marko", 0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var hello_default = _template("b", (input) => {
const $scope1_id = _scope_id();
_dynamic_tag($scope1_id, "a", item.content, {}, 0, 0, $sg__input_item);
_serialize_if($scope0_reason, 1) && writeScope($scope1_id, {});
}, 0, $scope0_id, "a", $sg__input_item, $sg__input_item, $sg__input_item);
}, 0, $scope0_id, "a", $sg__input_item, $sg__input_item, $sg__input_item, 0, 0, 1);
_dynamic_tag($scope0_id, "b", input.other, {}, 0, 0, _serialize_guard($scope0_reason, 2));
_serialize_if($scope0_reason, 0) && writeScope($scope0_id, {});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 13317,
"brotli": 5112
"min": 13370,
"brotli": 5132
},
"files": {
"tags/hello/index.marko": 196,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var hello_default = _template("__tests__/tags/hello/index.marko", (input) => {
_html(`</div>${_el_resume($scope1_id, "#div/0")}`);
_script($scope1_id, "__tests__/tags/hello/index.marko_1_attrs");
writeScope($scope1_id, {}, "__tests__/tags/hello/index.marko", "1:1");
}, 0, $scope0_id, "#text/0", $sg__input_list_item, $sg__input_list_item, $sg__input_list_item__OR__input_col, 0, 1);
}, 0, $scope0_id, "#text/0", $sg__input_list_item, $sg__input_list_item, $sg__input_list_item__OR__input_col, 0, 1, 1);
_for_of(input.col, ({ content, row, ...attrs }) => {
const $scope2_id = _scope_id();
_html("<div class=col");
Expand All @@ -22,10 +22,10 @@ var hello_default = _template("__tests__/tags/hello/index.marko", (input) => {
_html(`</div>${_el_resume($scope3_id, "#div/0")}`);
_script($scope3_id, "__tests__/tags/hello/index.marko_3_attrs");
writeScope($scope3_id, {}, "__tests__/tags/hello/index.marko", "7:3");
}, 0, $scope2_id, "#text/1", $sg__input_col, $sg__input_col, $sg__input_col, 0, 1);
}, 0, $scope2_id, "#text/1", $sg__input_col, $sg__input_col, $sg__input_col, 0, 1, 1);
_script($scope2_id, "__tests__/tags/hello/index.marko_2_attrs");
writeScope($scope2_id, {}, "__tests__/tags/hello/index.marko", "5:1");
}, 0, $scope0_id, "#text/1", $sg__input_col, $sg__input_col, $sg__input_list_item__OR__input_col);
}, 0, $scope0_id, "#text/1", $sg__input_col, $sg__input_col, $sg__input_list_item__OR__input_col, 0, 0, 1);
_serialize_if($scope0_reason, 0) && writeScope($scope0_id, {}, "__tests__/tags/hello/index.marko", 0);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var hello_default = _template("b", (input) => {
_html(`</div>${_el_resume($scope1_id, "a")}`);
_script($scope1_id, "b0");
writeScope($scope1_id, {});
}, 0, $scope0_id, "a", $sg__input_list_item, $sg__input_list_item, $sg__input_list_item__OR__input_col, 0, 1);
}, 0, $scope0_id, "a", $sg__input_list_item, $sg__input_list_item, $sg__input_list_item__OR__input_col, 0, 1, 1);
_for_of(input.col, ({ content, row, ...attrs }) => {
const $scope2_id = _scope_id();
_html("<div class=col");
Expand All @@ -22,10 +22,10 @@ var hello_default = _template("b", (input) => {
_html(`</div>${_el_resume($scope3_id, "a")}`);
_script($scope3_id, "b1");
writeScope($scope3_id, {});
}, 0, $scope2_id, "b", $sg__input_col, $sg__input_col, $sg__input_col, 0, 1);
}, 0, $scope2_id, "b", $sg__input_col, $sg__input_col, $sg__input_col, 0, 1, 1);
_script($scope2_id, "b2");
writeScope($scope2_id, {});
}, 0, $scope0_id, "b", $sg__input_col, $sg__input_col, $sg__input_list_item__OR__input_col);
}, 0, $scope0_id, "b", $sg__input_col, $sg__input_col, $sg__input_list_item__OR__input_col, 0, 0, 1);
_serialize_if($scope0_reason, 0) && writeScope($scope0_id, {});
});

Expand Down
Loading
Loading