@constela/server 16.0.0 → 16.0.1
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/index.js +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -805,13 +805,16 @@ async function renderPortal(node, ctx) {
|
|
|
805
805
|
}
|
|
806
806
|
async function renderLocalState(node, ctx) {
|
|
807
807
|
const localStateValues = {};
|
|
808
|
+
const progressiveLocals = { ...ctx.locals };
|
|
808
809
|
for (const [name, field] of Object.entries(node.state)) {
|
|
809
810
|
const initial = field.initial;
|
|
810
811
|
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
811
|
-
|
|
812
|
+
const evalCtx = { ...ctx, locals: progressiveLocals };
|
|
813
|
+
localStateValues[name] = evaluate(initial, evalCtx);
|
|
812
814
|
} else {
|
|
813
815
|
localStateValues[name] = initial;
|
|
814
816
|
}
|
|
817
|
+
progressiveLocals[name] = localStateValues[name];
|
|
815
818
|
}
|
|
816
819
|
const childCtx = {
|
|
817
820
|
...ctx,
|
|
@@ -1628,13 +1631,16 @@ async function renderPortalToStream(node, ctx) {
|
|
|
1628
1631
|
}
|
|
1629
1632
|
async function renderLocalStateToStream(node, ctx) {
|
|
1630
1633
|
const localStateValues = {};
|
|
1634
|
+
const progressiveLocals = { ...ctx.locals };
|
|
1631
1635
|
for (const [name, field] of Object.entries(node.state)) {
|
|
1632
1636
|
const initial = field.initial;
|
|
1633
1637
|
if (initial && typeof initial === "object" && "expr" in initial) {
|
|
1634
|
-
|
|
1638
|
+
const evalCtx = { ...ctx, locals: progressiveLocals };
|
|
1639
|
+
localStateValues[name] = evaluate2(initial, evalCtx);
|
|
1635
1640
|
} else {
|
|
1636
1641
|
localStateValues[name] = initial;
|
|
1637
1642
|
}
|
|
1643
|
+
progressiveLocals[name] = localStateValues[name];
|
|
1638
1644
|
}
|
|
1639
1645
|
const childCtx = {
|
|
1640
1646
|
...ctx,
|