solid-js 1.4.3 → 1.4.6
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/dev.cjs +37 -31
- package/dist/dev.js +37 -31
- package/dist/solid.cjs +30 -30
- package/dist/solid.js +30 -30
- package/package.json +2 -2
- package/store/dist/dev.cjs +14 -9
- package/store/dist/dev.js +14 -9
- package/store/dist/server.cjs +16 -2
- package/store/dist/server.js +16 -2
- package/store/dist/store.cjs +14 -9
- package/store/dist/store.js +14 -9
- package/store/types/store.d.ts +6 -4
- package/types/index.d.ts +1 -1
- package/types/reactive/signal.d.ts +1 -0
- package/web/dist/dev.cjs +40 -24
- package/web/dist/dev.js +40 -24
- package/web/dist/server.cjs +7 -3
- package/web/dist/server.js +7 -3
- package/web/dist/web.cjs +40 -24
- package/web/dist/web.js +40 -24
- package/web/types/index.d.ts +6 -3
- package/web/types/server-mock.d.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -161,17 +161,24 @@ let rootCount = 0;
|
|
|
161
161
|
function createRoot(fn, detachedOwner) {
|
|
162
162
|
const listener = Listener,
|
|
163
163
|
owner = Owner,
|
|
164
|
-
|
|
164
|
+
unowned = fn.length === 0,
|
|
165
|
+
root = unowned && !"_SOLID_DEV_" ? UNOWNED : {
|
|
165
166
|
owned: null,
|
|
166
167
|
cleanups: null,
|
|
167
168
|
context: null,
|
|
168
169
|
owner: detachedOwner || owner
|
|
169
|
-
}
|
|
170
|
-
|
|
170
|
+
},
|
|
171
|
+
updateFn = unowned ? () => fn(() => {
|
|
172
|
+
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
173
|
+
}) : () => fn(() => cleanNode(root));
|
|
174
|
+
{
|
|
175
|
+
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
176
|
+
globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
|
|
177
|
+
}
|
|
171
178
|
Owner = root;
|
|
172
179
|
Listener = null;
|
|
173
180
|
try {
|
|
174
|
-
return runUpdates(
|
|
181
|
+
return runUpdates(updateFn, true);
|
|
175
182
|
} finally {
|
|
176
183
|
Listener = listener;
|
|
177
184
|
Owner = owner;
|
|
@@ -802,10 +809,8 @@ function runUpdates(fn, init) {
|
|
|
802
809
|
completeUpdates(wait);
|
|
803
810
|
return res;
|
|
804
811
|
} catch (err) {
|
|
812
|
+
if (!Updates) Effects = null;
|
|
805
813
|
handleError(err);
|
|
806
|
-
} finally {
|
|
807
|
-
Updates = null;
|
|
808
|
-
if (!wait) Effects = null;
|
|
809
814
|
}
|
|
810
815
|
}
|
|
811
816
|
function completeUpdates(wait) {
|
|
@@ -824,14 +829,16 @@ function completeUpdates(wait) {
|
|
|
824
829
|
return;
|
|
825
830
|
}
|
|
826
831
|
const sources = Transition.sources;
|
|
832
|
+
const disposed = Transition.disposed;
|
|
827
833
|
res = Transition.resolve;
|
|
828
|
-
|
|
834
|
+
for (const e of Effects) {
|
|
829
835
|
"tState" in e && (e.state = e.tState);
|
|
830
836
|
delete e.tState;
|
|
831
|
-
}
|
|
837
|
+
}
|
|
832
838
|
Transition = null;
|
|
833
839
|
batch(() => {
|
|
834
|
-
|
|
840
|
+
for (const d of disposed) cleanNode(d);
|
|
841
|
+
for (const v of sources) {
|
|
835
842
|
v.value = v.tValue;
|
|
836
843
|
if (v.owned) {
|
|
837
844
|
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
@@ -840,7 +847,7 @@ function completeUpdates(wait) {
|
|
|
840
847
|
delete v.tValue;
|
|
841
848
|
delete v.tOwned;
|
|
842
849
|
v.tState = 0;
|
|
843
|
-
}
|
|
850
|
+
}
|
|
844
851
|
setTransPending(false);
|
|
845
852
|
});
|
|
846
853
|
}
|
|
@@ -946,6 +953,7 @@ function cleanNode(node) {
|
|
|
946
953
|
}
|
|
947
954
|
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
948
955
|
node.context = null;
|
|
956
|
+
delete node.sourceMap;
|
|
949
957
|
}
|
|
950
958
|
function reset(node, top) {
|
|
951
959
|
if (!top) {
|
|
@@ -959,7 +967,7 @@ function reset(node, top) {
|
|
|
959
967
|
function handleError(err) {
|
|
960
968
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
961
969
|
if (!fns) throw err;
|
|
962
|
-
|
|
970
|
+
for (const f of fns) f(err);
|
|
963
971
|
}
|
|
964
972
|
function lookup(owner, key) {
|
|
965
973
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1442,27 +1450,24 @@ function ErrorBoundary(props) {
|
|
|
1442
1450
|
|
|
1443
1451
|
const SuspenseListContext = createContext();
|
|
1444
1452
|
function SuspenseList(props) {
|
|
1445
|
-
let
|
|
1446
|
-
suspenseSetter,
|
|
1447
|
-
showContent,
|
|
1448
|
-
showFallback;
|
|
1453
|
+
let suspenseSetter, showContent, showFallback;
|
|
1449
1454
|
const listContext = useContext(SuspenseListContext);
|
|
1450
1455
|
if (listContext) {
|
|
1451
1456
|
const [inFallback, setFallback] = createSignal(false);
|
|
1452
1457
|
suspenseSetter = setFallback;
|
|
1453
1458
|
[showContent, showFallback] = listContext.register(inFallback);
|
|
1454
1459
|
}
|
|
1455
|
-
const registry = [],
|
|
1460
|
+
const [registry, setRegistry] = createSignal([]),
|
|
1456
1461
|
comp = createComponent(SuspenseListContext.Provider, {
|
|
1457
1462
|
value: {
|
|
1458
1463
|
register: inFallback => {
|
|
1459
1464
|
const [showingContent, showContent] = createSignal(false),
|
|
1460
1465
|
[showingFallback, showFallback] = createSignal(false);
|
|
1461
|
-
registry[
|
|
1466
|
+
setRegistry(registry => [...registry, {
|
|
1462
1467
|
inFallback,
|
|
1463
1468
|
showContent,
|
|
1464
1469
|
showFallback
|
|
1465
|
-
};
|
|
1470
|
+
}]);
|
|
1466
1471
|
return [showingContent, showingFallback];
|
|
1467
1472
|
}
|
|
1468
1473
|
},
|
|
@@ -1475,31 +1480,32 @@ function SuspenseList(props) {
|
|
|
1475
1480
|
tail = props.tail,
|
|
1476
1481
|
visibleContent = showContent ? showContent() : true,
|
|
1477
1482
|
visibleFallback = showFallback ? showFallback() : true,
|
|
1483
|
+
reg = registry(),
|
|
1478
1484
|
reverse = reveal === "backwards";
|
|
1479
1485
|
if (reveal === "together") {
|
|
1480
|
-
const all =
|
|
1486
|
+
const all = reg.every(i => !i.inFallback());
|
|
1481
1487
|
suspenseSetter && suspenseSetter(!all);
|
|
1482
|
-
|
|
1488
|
+
reg.forEach(i => {
|
|
1483
1489
|
i.showContent(all && visibleContent);
|
|
1484
1490
|
i.showFallback(visibleFallback);
|
|
1485
1491
|
});
|
|
1486
1492
|
return;
|
|
1487
1493
|
}
|
|
1488
1494
|
let stop = false;
|
|
1489
|
-
for (let i = 0, len =
|
|
1495
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1490
1496
|
const n = reverse ? len - i - 1 : i,
|
|
1491
|
-
s =
|
|
1497
|
+
s = reg[n].inFallback();
|
|
1492
1498
|
if (!stop && !s) {
|
|
1493
|
-
|
|
1494
|
-
|
|
1499
|
+
reg[n].showContent(visibleContent);
|
|
1500
|
+
reg[n].showFallback(visibleFallback);
|
|
1495
1501
|
} else {
|
|
1496
1502
|
const next = !stop;
|
|
1497
1503
|
if (next && suspenseSetter) suspenseSetter(true);
|
|
1498
1504
|
if (!tail || next && tail === "collapsed") {
|
|
1499
|
-
|
|
1500
|
-
} else
|
|
1505
|
+
reg[n].showFallback(visibleFallback);
|
|
1506
|
+
} else reg[n].showFallback(false);
|
|
1501
1507
|
stop = true;
|
|
1502
|
-
|
|
1508
|
+
reg[n].showContent(next);
|
|
1503
1509
|
}
|
|
1504
1510
|
}
|
|
1505
1511
|
if (!stop && suspenseSetter) suspenseSetter(false);
|
|
@@ -1528,7 +1534,7 @@ function Suspense(props) {
|
|
|
1528
1534
|
resolved: false
|
|
1529
1535
|
},
|
|
1530
1536
|
owner = getOwner();
|
|
1531
|
-
if (sharedConfig.context) {
|
|
1537
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1532
1538
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1533
1539
|
p = sharedConfig.load(key);
|
|
1534
1540
|
if (p) {
|
|
@@ -1561,7 +1567,7 @@ function Suspense(props) {
|
|
|
1561
1567
|
return flicker = undefined;
|
|
1562
1568
|
}
|
|
1563
1569
|
if (ctx && p === undefined) setHydrateContext();
|
|
1564
|
-
const rendered =
|
|
1570
|
+
const rendered = createMemo(() => props.children);
|
|
1565
1571
|
return createMemo(() => {
|
|
1566
1572
|
const inFallback = store.inFallback(),
|
|
1567
1573
|
visibleContent = showContent ? showContent() : true,
|
|
@@ -1571,7 +1577,7 @@ function Suspense(props) {
|
|
|
1571
1577
|
store.resolved = true;
|
|
1572
1578
|
ctx = p = undefined;
|
|
1573
1579
|
resumeEffects(store.effects);
|
|
1574
|
-
return rendered;
|
|
1580
|
+
return rendered();
|
|
1575
1581
|
}
|
|
1576
1582
|
if (!visibleFallback) return;
|
|
1577
1583
|
return createRoot(disposer => {
|
package/dist/dev.js
CHANGED
|
@@ -157,17 +157,24 @@ let rootCount = 0;
|
|
|
157
157
|
function createRoot(fn, detachedOwner) {
|
|
158
158
|
const listener = Listener,
|
|
159
159
|
owner = Owner,
|
|
160
|
-
|
|
160
|
+
unowned = fn.length === 0,
|
|
161
|
+
root = unowned && !"_SOLID_DEV_" ? UNOWNED : {
|
|
161
162
|
owned: null,
|
|
162
163
|
cleanups: null,
|
|
163
164
|
context: null,
|
|
164
165
|
owner: detachedOwner || owner
|
|
165
|
-
}
|
|
166
|
-
|
|
166
|
+
},
|
|
167
|
+
updateFn = unowned ? () => fn(() => {
|
|
168
|
+
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
169
|
+
}) : () => fn(() => cleanNode(root));
|
|
170
|
+
{
|
|
171
|
+
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
172
|
+
globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
|
|
173
|
+
}
|
|
167
174
|
Owner = root;
|
|
168
175
|
Listener = null;
|
|
169
176
|
try {
|
|
170
|
-
return runUpdates(
|
|
177
|
+
return runUpdates(updateFn, true);
|
|
171
178
|
} finally {
|
|
172
179
|
Listener = listener;
|
|
173
180
|
Owner = owner;
|
|
@@ -798,10 +805,8 @@ function runUpdates(fn, init) {
|
|
|
798
805
|
completeUpdates(wait);
|
|
799
806
|
return res;
|
|
800
807
|
} catch (err) {
|
|
808
|
+
if (!Updates) Effects = null;
|
|
801
809
|
handleError(err);
|
|
802
|
-
} finally {
|
|
803
|
-
Updates = null;
|
|
804
|
-
if (!wait) Effects = null;
|
|
805
810
|
}
|
|
806
811
|
}
|
|
807
812
|
function completeUpdates(wait) {
|
|
@@ -820,14 +825,16 @@ function completeUpdates(wait) {
|
|
|
820
825
|
return;
|
|
821
826
|
}
|
|
822
827
|
const sources = Transition.sources;
|
|
828
|
+
const disposed = Transition.disposed;
|
|
823
829
|
res = Transition.resolve;
|
|
824
|
-
|
|
830
|
+
for (const e of Effects) {
|
|
825
831
|
"tState" in e && (e.state = e.tState);
|
|
826
832
|
delete e.tState;
|
|
827
|
-
}
|
|
833
|
+
}
|
|
828
834
|
Transition = null;
|
|
829
835
|
batch(() => {
|
|
830
|
-
|
|
836
|
+
for (const d of disposed) cleanNode(d);
|
|
837
|
+
for (const v of sources) {
|
|
831
838
|
v.value = v.tValue;
|
|
832
839
|
if (v.owned) {
|
|
833
840
|
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
@@ -836,7 +843,7 @@ function completeUpdates(wait) {
|
|
|
836
843
|
delete v.tValue;
|
|
837
844
|
delete v.tOwned;
|
|
838
845
|
v.tState = 0;
|
|
839
|
-
}
|
|
846
|
+
}
|
|
840
847
|
setTransPending(false);
|
|
841
848
|
});
|
|
842
849
|
}
|
|
@@ -942,6 +949,7 @@ function cleanNode(node) {
|
|
|
942
949
|
}
|
|
943
950
|
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
944
951
|
node.context = null;
|
|
952
|
+
delete node.sourceMap;
|
|
945
953
|
}
|
|
946
954
|
function reset(node, top) {
|
|
947
955
|
if (!top) {
|
|
@@ -955,7 +963,7 @@ function reset(node, top) {
|
|
|
955
963
|
function handleError(err) {
|
|
956
964
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
957
965
|
if (!fns) throw err;
|
|
958
|
-
|
|
966
|
+
for (const f of fns) f(err);
|
|
959
967
|
}
|
|
960
968
|
function lookup(owner, key) {
|
|
961
969
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1438,27 +1446,24 @@ function ErrorBoundary(props) {
|
|
|
1438
1446
|
|
|
1439
1447
|
const SuspenseListContext = createContext();
|
|
1440
1448
|
function SuspenseList(props) {
|
|
1441
|
-
let
|
|
1442
|
-
suspenseSetter,
|
|
1443
|
-
showContent,
|
|
1444
|
-
showFallback;
|
|
1449
|
+
let suspenseSetter, showContent, showFallback;
|
|
1445
1450
|
const listContext = useContext(SuspenseListContext);
|
|
1446
1451
|
if (listContext) {
|
|
1447
1452
|
const [inFallback, setFallback] = createSignal(false);
|
|
1448
1453
|
suspenseSetter = setFallback;
|
|
1449
1454
|
[showContent, showFallback] = listContext.register(inFallback);
|
|
1450
1455
|
}
|
|
1451
|
-
const registry = [],
|
|
1456
|
+
const [registry, setRegistry] = createSignal([]),
|
|
1452
1457
|
comp = createComponent(SuspenseListContext.Provider, {
|
|
1453
1458
|
value: {
|
|
1454
1459
|
register: inFallback => {
|
|
1455
1460
|
const [showingContent, showContent] = createSignal(false),
|
|
1456
1461
|
[showingFallback, showFallback] = createSignal(false);
|
|
1457
|
-
registry[
|
|
1462
|
+
setRegistry(registry => [...registry, {
|
|
1458
1463
|
inFallback,
|
|
1459
1464
|
showContent,
|
|
1460
1465
|
showFallback
|
|
1461
|
-
};
|
|
1466
|
+
}]);
|
|
1462
1467
|
return [showingContent, showingFallback];
|
|
1463
1468
|
}
|
|
1464
1469
|
},
|
|
@@ -1471,31 +1476,32 @@ function SuspenseList(props) {
|
|
|
1471
1476
|
tail = props.tail,
|
|
1472
1477
|
visibleContent = showContent ? showContent() : true,
|
|
1473
1478
|
visibleFallback = showFallback ? showFallback() : true,
|
|
1479
|
+
reg = registry(),
|
|
1474
1480
|
reverse = reveal === "backwards";
|
|
1475
1481
|
if (reveal === "together") {
|
|
1476
|
-
const all =
|
|
1482
|
+
const all = reg.every(i => !i.inFallback());
|
|
1477
1483
|
suspenseSetter && suspenseSetter(!all);
|
|
1478
|
-
|
|
1484
|
+
reg.forEach(i => {
|
|
1479
1485
|
i.showContent(all && visibleContent);
|
|
1480
1486
|
i.showFallback(visibleFallback);
|
|
1481
1487
|
});
|
|
1482
1488
|
return;
|
|
1483
1489
|
}
|
|
1484
1490
|
let stop = false;
|
|
1485
|
-
for (let i = 0, len =
|
|
1491
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1486
1492
|
const n = reverse ? len - i - 1 : i,
|
|
1487
|
-
s =
|
|
1493
|
+
s = reg[n].inFallback();
|
|
1488
1494
|
if (!stop && !s) {
|
|
1489
|
-
|
|
1490
|
-
|
|
1495
|
+
reg[n].showContent(visibleContent);
|
|
1496
|
+
reg[n].showFallback(visibleFallback);
|
|
1491
1497
|
} else {
|
|
1492
1498
|
const next = !stop;
|
|
1493
1499
|
if (next && suspenseSetter) suspenseSetter(true);
|
|
1494
1500
|
if (!tail || next && tail === "collapsed") {
|
|
1495
|
-
|
|
1496
|
-
} else
|
|
1501
|
+
reg[n].showFallback(visibleFallback);
|
|
1502
|
+
} else reg[n].showFallback(false);
|
|
1497
1503
|
stop = true;
|
|
1498
|
-
|
|
1504
|
+
reg[n].showContent(next);
|
|
1499
1505
|
}
|
|
1500
1506
|
}
|
|
1501
1507
|
if (!stop && suspenseSetter) suspenseSetter(false);
|
|
@@ -1524,7 +1530,7 @@ function Suspense(props) {
|
|
|
1524
1530
|
resolved: false
|
|
1525
1531
|
},
|
|
1526
1532
|
owner = getOwner();
|
|
1527
|
-
if (sharedConfig.context) {
|
|
1533
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1528
1534
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1529
1535
|
p = sharedConfig.load(key);
|
|
1530
1536
|
if (p) {
|
|
@@ -1557,7 +1563,7 @@ function Suspense(props) {
|
|
|
1557
1563
|
return flicker = undefined;
|
|
1558
1564
|
}
|
|
1559
1565
|
if (ctx && p === undefined) setHydrateContext();
|
|
1560
|
-
const rendered =
|
|
1566
|
+
const rendered = createMemo(() => props.children);
|
|
1561
1567
|
return createMemo(() => {
|
|
1562
1568
|
const inFallback = store.inFallback(),
|
|
1563
1569
|
visibleContent = showContent ? showContent() : true,
|
|
@@ -1567,7 +1573,7 @@ function Suspense(props) {
|
|
|
1567
1573
|
store.resolved = true;
|
|
1568
1574
|
ctx = p = undefined;
|
|
1569
1575
|
resumeEffects(store.effects);
|
|
1570
|
-
return rendered;
|
|
1576
|
+
return rendered();
|
|
1571
1577
|
}
|
|
1572
1578
|
if (!visibleFallback) return;
|
|
1573
1579
|
return createRoot(disposer => {
|
package/dist/solid.cjs
CHANGED
|
@@ -160,16 +160,18 @@ let ExecCount = 0;
|
|
|
160
160
|
function createRoot(fn, detachedOwner) {
|
|
161
161
|
const listener = Listener,
|
|
162
162
|
owner = Owner,
|
|
163
|
-
|
|
163
|
+
unowned = fn.length === 0,
|
|
164
|
+
root = unowned && !false ? UNOWNED : {
|
|
164
165
|
owned: null,
|
|
165
166
|
cleanups: null,
|
|
166
167
|
context: null,
|
|
167
168
|
owner: detachedOwner || owner
|
|
168
|
-
}
|
|
169
|
+
},
|
|
170
|
+
updateFn = unowned ? fn : () => fn(() => cleanNode(root));
|
|
169
171
|
Owner = root;
|
|
170
172
|
Listener = null;
|
|
171
173
|
try {
|
|
172
|
-
return runUpdates(
|
|
174
|
+
return runUpdates(updateFn, true);
|
|
173
175
|
} finally {
|
|
174
176
|
Listener = listener;
|
|
175
177
|
Owner = owner;
|
|
@@ -745,10 +747,8 @@ function runUpdates(fn, init) {
|
|
|
745
747
|
completeUpdates(wait);
|
|
746
748
|
return res;
|
|
747
749
|
} catch (err) {
|
|
750
|
+
if (!Updates) Effects = null;
|
|
748
751
|
handleError(err);
|
|
749
|
-
} finally {
|
|
750
|
-
Updates = null;
|
|
751
|
-
if (!wait) Effects = null;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
function completeUpdates(wait) {
|
|
@@ -767,14 +767,16 @@ function completeUpdates(wait) {
|
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
769
769
|
const sources = Transition.sources;
|
|
770
|
+
const disposed = Transition.disposed;
|
|
770
771
|
res = Transition.resolve;
|
|
771
|
-
|
|
772
|
+
for (const e of Effects) {
|
|
772
773
|
"tState" in e && (e.state = e.tState);
|
|
773
774
|
delete e.tState;
|
|
774
|
-
}
|
|
775
|
+
}
|
|
775
776
|
Transition = null;
|
|
776
777
|
batch(() => {
|
|
777
|
-
|
|
778
|
+
for (const d of disposed) cleanNode(d);
|
|
779
|
+
for (const v of sources) {
|
|
778
780
|
v.value = v.tValue;
|
|
779
781
|
if (v.owned) {
|
|
780
782
|
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
@@ -783,7 +785,7 @@ function completeUpdates(wait) {
|
|
|
783
785
|
delete v.tValue;
|
|
784
786
|
delete v.tOwned;
|
|
785
787
|
v.tState = 0;
|
|
786
|
-
}
|
|
788
|
+
}
|
|
787
789
|
setTransPending(false);
|
|
788
790
|
});
|
|
789
791
|
}
|
|
@@ -901,7 +903,7 @@ function reset(node, top) {
|
|
|
901
903
|
function handleError(err) {
|
|
902
904
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
903
905
|
if (!fns) throw err;
|
|
904
|
-
|
|
906
|
+
for (const f of fns) f(err);
|
|
905
907
|
}
|
|
906
908
|
function lookup(owner, key) {
|
|
907
909
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1357,27 +1359,24 @@ function ErrorBoundary(props) {
|
|
|
1357
1359
|
|
|
1358
1360
|
const SuspenseListContext = createContext();
|
|
1359
1361
|
function SuspenseList(props) {
|
|
1360
|
-
let
|
|
1361
|
-
suspenseSetter,
|
|
1362
|
-
showContent,
|
|
1363
|
-
showFallback;
|
|
1362
|
+
let suspenseSetter, showContent, showFallback;
|
|
1364
1363
|
const listContext = useContext(SuspenseListContext);
|
|
1365
1364
|
if (listContext) {
|
|
1366
1365
|
const [inFallback, setFallback] = createSignal(false);
|
|
1367
1366
|
suspenseSetter = setFallback;
|
|
1368
1367
|
[showContent, showFallback] = listContext.register(inFallback);
|
|
1369
1368
|
}
|
|
1370
|
-
const registry = [],
|
|
1369
|
+
const [registry, setRegistry] = createSignal([]),
|
|
1371
1370
|
comp = createComponent(SuspenseListContext.Provider, {
|
|
1372
1371
|
value: {
|
|
1373
1372
|
register: inFallback => {
|
|
1374
1373
|
const [showingContent, showContent] = createSignal(false),
|
|
1375
1374
|
[showingFallback, showFallback] = createSignal(false);
|
|
1376
|
-
registry[
|
|
1375
|
+
setRegistry(registry => [...registry, {
|
|
1377
1376
|
inFallback,
|
|
1378
1377
|
showContent,
|
|
1379
1378
|
showFallback
|
|
1380
|
-
};
|
|
1379
|
+
}]);
|
|
1381
1380
|
return [showingContent, showingFallback];
|
|
1382
1381
|
}
|
|
1383
1382
|
},
|
|
@@ -1390,31 +1389,32 @@ function SuspenseList(props) {
|
|
|
1390
1389
|
tail = props.tail,
|
|
1391
1390
|
visibleContent = showContent ? showContent() : true,
|
|
1392
1391
|
visibleFallback = showFallback ? showFallback() : true,
|
|
1392
|
+
reg = registry(),
|
|
1393
1393
|
reverse = reveal === "backwards";
|
|
1394
1394
|
if (reveal === "together") {
|
|
1395
|
-
const all =
|
|
1395
|
+
const all = reg.every(i => !i.inFallback());
|
|
1396
1396
|
suspenseSetter && suspenseSetter(!all);
|
|
1397
|
-
|
|
1397
|
+
reg.forEach(i => {
|
|
1398
1398
|
i.showContent(all && visibleContent);
|
|
1399
1399
|
i.showFallback(visibleFallback);
|
|
1400
1400
|
});
|
|
1401
1401
|
return;
|
|
1402
1402
|
}
|
|
1403
1403
|
let stop = false;
|
|
1404
|
-
for (let i = 0, len =
|
|
1404
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1405
1405
|
const n = reverse ? len - i - 1 : i,
|
|
1406
|
-
s =
|
|
1406
|
+
s = reg[n].inFallback();
|
|
1407
1407
|
if (!stop && !s) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1408
|
+
reg[n].showContent(visibleContent);
|
|
1409
|
+
reg[n].showFallback(visibleFallback);
|
|
1410
1410
|
} else {
|
|
1411
1411
|
const next = !stop;
|
|
1412
1412
|
if (next && suspenseSetter) suspenseSetter(true);
|
|
1413
1413
|
if (!tail || next && tail === "collapsed") {
|
|
1414
|
-
|
|
1415
|
-
} else
|
|
1414
|
+
reg[n].showFallback(visibleFallback);
|
|
1415
|
+
} else reg[n].showFallback(false);
|
|
1416
1416
|
stop = true;
|
|
1417
|
-
|
|
1417
|
+
reg[n].showContent(next);
|
|
1418
1418
|
}
|
|
1419
1419
|
}
|
|
1420
1420
|
if (!stop && suspenseSetter) suspenseSetter(false);
|
|
@@ -1443,7 +1443,7 @@ function Suspense(props) {
|
|
|
1443
1443
|
resolved: false
|
|
1444
1444
|
},
|
|
1445
1445
|
owner = getOwner();
|
|
1446
|
-
if (sharedConfig.context) {
|
|
1446
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1447
1447
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1448
1448
|
p = sharedConfig.load(key);
|
|
1449
1449
|
if (p) {
|
|
@@ -1476,7 +1476,7 @@ function Suspense(props) {
|
|
|
1476
1476
|
return flicker = undefined;
|
|
1477
1477
|
}
|
|
1478
1478
|
if (ctx && p === undefined) setHydrateContext();
|
|
1479
|
-
const rendered =
|
|
1479
|
+
const rendered = createMemo(() => props.children);
|
|
1480
1480
|
return createMemo(() => {
|
|
1481
1481
|
const inFallback = store.inFallback(),
|
|
1482
1482
|
visibleContent = showContent ? showContent() : true,
|
|
@@ -1486,7 +1486,7 @@ function Suspense(props) {
|
|
|
1486
1486
|
store.resolved = true;
|
|
1487
1487
|
ctx = p = undefined;
|
|
1488
1488
|
resumeEffects(store.effects);
|
|
1489
|
-
return rendered;
|
|
1489
|
+
return rendered();
|
|
1490
1490
|
}
|
|
1491
1491
|
if (!visibleFallback) return;
|
|
1492
1492
|
return createRoot(disposer => {
|