@stacksjs/stx 0.2.124 → 0.2.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/signals.js CHANGED
@@ -3782,37 +3782,38 @@ catch (e2) {
3782
3782
  pick.el.__stx_shown_at = performance.now();
3783
3783
  if (!pick.childrenProcessed) {
3784
3784
  pick.childrenProcessed = true;
3785
- // Defer child processing (same rationale as bindIf, CLAUDE.md
3786
- // item 35): keep child effects from subscribing to THIS chain
3787
- // effect's tracked signals.
3788
- (function (branch) {
3789
- setTimeout(function () {
3790
- var childScope = { ...globalHelpers, ...capturedComponentScope, ...(branch.capturedElementScope || {}) };
3791
- // Components compiled inside any branch of an if/else-if/else
3792
- // chain carry scoped setup scripts with them. Branch nodes are
3793
- // detached before those scripts can execute, so simply
3794
- // re-inserting the selected branch leaves component props,
3795
- // events, directives, and projected slot expressions inert.
3796
- // Hydrate those scopes before the normal subtree walk, matching
3797
- // the single-template :if and :for insertion paths.
3798
- var previouslyTrackedNodes = new Set();
3799
- branch.nodes.forEach(function (n) {
3800
- if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
3801
- });
3802
- hydrateComponentScopes(branch.nodes, childScope);
3803
- branch.nodes.forEach(function (n) {
3804
- if (n.nodeType !== 1) return; // whitespace/text between template children
3805
- // A scoped component receives its disposer in the outer scope
3806
- // walk immediately after processElement returns from binding
3807
- // this conditional. That first pass intentionally stops at
3808
- // :if, so a disposer does not mean its children were hydrated.
3809
- if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
3810
- processElement(n, childScope);
3811
- n.removeAttribute('x-cloak');
3812
- n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
3813
- });
3814
- }, 0);
3815
- })(pick);
3785
+ // Hydrate before the outer scope walk can see the inserted branch.
3786
+ // Chromium executes scripts cloned from template.content as soon as
3787
+ // they are connected, so deferring this pass allowed the global walk
3788
+ // to process projected slot expressions without the loop caller
3789
+ // scope. peek() keeps this synchronous pass from subscribing child
3790
+ // reads to the current chain effect.
3791
+ peek(function () {
3792
+ var childScope = { ...globalHelpers, ...capturedComponentScope, ...(pick.capturedElementScope || {}) };
3793
+ // Components compiled inside any branch of an if/else-if/else
3794
+ // chain carry scoped setup scripts with them. Branch nodes are
3795
+ // detached before those scripts can execute, so simply
3796
+ // re-inserting the selected branch leaves component props,
3797
+ // events, directives, and projected slot expressions inert.
3798
+ // Hydrate those scopes before the normal subtree walk, matching
3799
+ // the single-template :if and :for insertion paths.
3800
+ var previouslyTrackedNodes = new Set();
3801
+ pick.nodes.forEach(function (n) {
3802
+ if (n && n.__stx_disposers) previouslyTrackedNodes.add(n);
3803
+ });
3804
+ hydrateComponentScopes(pick.nodes, childScope);
3805
+ pick.nodes.forEach(function (n) {
3806
+ if (n.nodeType !== 1) return; // whitespace/text between template children
3807
+ // A scoped component receives its disposer in the outer scope
3808
+ // walk immediately after processElement returns from binding
3809
+ // this conditional. That first pass intentionally stops at
3810
+ // :if, so a disposer does not mean its children were hydrated.
3811
+ if (previouslyTrackedNodes.has(n) || !n.__stx_disposers)
3812
+ processElement(n, childScope);
3813
+ n.removeAttribute('x-cloak');
3814
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
3815
+ });
3816
+ });
3816
3817
  }
3817
3818
  }
3818
3819
 
@@ -3983,10 +3984,13 @@ else if (!value && isInserted) {
3983
3984
  else if (value && isInserted && !childrenProcessed) {
3984
3985
  // Initial template content is cloned before the effect runs. Process
3985
3986
  // it after the condition is confirmed so hidden branches stay inert.
3987
+ // Keep hydration synchronous so the outer scope walk cannot bind
3988
+ // caller-owned slot expressions first, while peek() prevents child
3989
+ // reads from subscribing to this conditional effect.
3986
3990
  childrenProcessed = true;
3987
- setTimeout(function() {
3991
+ peek(function() {
3988
3992
  if (isInserted) processTemplateNodes(currentNodes);
3989
- }, 0);
3993
+ });
3990
3994
  }
3991
3995
  }
3992
3996
  else {