solid-js 1.4.2 → 1.4.5
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 +43 -34
- package/dist/dev.js +43 -34
- package/dist/server.cjs +9 -6
- package/dist/server.js +9 -6
- package/dist/solid.cjs +36 -33
- package/dist/solid.js +36 -33
- package/package.json +2 -2
- package/store/README.md +2 -2
- package/store/dist/dev.cjs +32 -17
- package/store/dist/dev.js +32 -17
- package/store/dist/server.cjs +16 -2
- package/store/dist/server.js +16 -2
- package/store/dist/store.cjs +32 -17
- package/store/dist/store.js +32 -17
- package/store/types/modifiers.d.ts +1 -2
- package/store/types/server.d.ts +3 -3
- package/store/types/store.d.ts +17 -8
- package/types/reactive/signal.d.ts +10 -6
- package/types/render/hydration.d.ts +1 -1
- package/web/dist/dev.cjs +40 -23
- package/web/dist/dev.js +40 -23
- package/web/dist/server.cjs +7 -3
- package/web/dist/server.js +7 -3
- package/web/dist/web.cjs +40 -23
- package/web/dist/web.js +40 -23
- 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;
|
|
@@ -824,14 +831,16 @@ function completeUpdates(wait) {
|
|
|
824
831
|
return;
|
|
825
832
|
}
|
|
826
833
|
const sources = Transition.sources;
|
|
834
|
+
const disposed = Transition.disposed;
|
|
827
835
|
res = Transition.resolve;
|
|
828
|
-
|
|
836
|
+
for (const e of Effects) {
|
|
829
837
|
"tState" in e && (e.state = e.tState);
|
|
830
838
|
delete e.tState;
|
|
831
|
-
}
|
|
839
|
+
}
|
|
832
840
|
Transition = null;
|
|
833
841
|
batch(() => {
|
|
834
|
-
|
|
842
|
+
for (const d of disposed) cleanNode(d);
|
|
843
|
+
for (const v of sources) {
|
|
835
844
|
v.value = v.tValue;
|
|
836
845
|
if (v.owned) {
|
|
837
846
|
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
@@ -840,7 +849,7 @@ function completeUpdates(wait) {
|
|
|
840
849
|
delete v.tValue;
|
|
841
850
|
delete v.tOwned;
|
|
842
851
|
v.tState = 0;
|
|
843
|
-
}
|
|
852
|
+
}
|
|
844
853
|
setTransPending(false);
|
|
845
854
|
});
|
|
846
855
|
}
|
|
@@ -946,6 +955,7 @@ function cleanNode(node) {
|
|
|
946
955
|
}
|
|
947
956
|
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
948
957
|
node.context = null;
|
|
958
|
+
delete node.sourceMap;
|
|
949
959
|
}
|
|
950
960
|
function reset(node, top) {
|
|
951
961
|
if (!top) {
|
|
@@ -959,7 +969,7 @@ function reset(node, top) {
|
|
|
959
969
|
function handleError(err) {
|
|
960
970
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
961
971
|
if (!fns) throw err;
|
|
962
|
-
|
|
972
|
+
for (const f of fns) f(err);
|
|
963
973
|
}
|
|
964
974
|
function lookup(owner, key) {
|
|
965
975
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1415,24 +1425,25 @@ function Match(props) {
|
|
|
1415
1425
|
return props;
|
|
1416
1426
|
}
|
|
1417
1427
|
let Errors;
|
|
1428
|
+
const NoErrors = {};
|
|
1418
1429
|
function resetErrorBoundaries() {
|
|
1419
|
-
Errors && [...Errors].forEach(fn => fn());
|
|
1430
|
+
Errors && [...Errors].forEach(fn => fn(NoErrors));
|
|
1420
1431
|
}
|
|
1421
1432
|
function ErrorBoundary(props) {
|
|
1422
|
-
let err =
|
|
1433
|
+
let err = NoErrors;
|
|
1423
1434
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1424
|
-
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1435
|
+
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count) || NoErrors;
|
|
1425
1436
|
}
|
|
1426
1437
|
const [errored, setErrored] = createSignal(err);
|
|
1427
1438
|
Errors || (Errors = new Set());
|
|
1428
1439
|
Errors.add(setErrored);
|
|
1429
1440
|
onCleanup(() => Errors.delete(setErrored));
|
|
1430
|
-
let e;
|
|
1431
1441
|
return createMemo(() => {
|
|
1432
|
-
|
|
1442
|
+
let e;
|
|
1443
|
+
if ((e = errored()) !== NoErrors) {
|
|
1433
1444
|
const f = props.fallback;
|
|
1434
1445
|
if ((typeof f !== "function" || f.length == 0)) console.error(e);
|
|
1435
|
-
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(
|
|
1446
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(NoErrors))) : f;
|
|
1436
1447
|
}
|
|
1437
1448
|
onError(setErrored);
|
|
1438
1449
|
return props.children;
|
|
@@ -1441,27 +1452,24 @@ function ErrorBoundary(props) {
|
|
|
1441
1452
|
|
|
1442
1453
|
const SuspenseListContext = createContext();
|
|
1443
1454
|
function SuspenseList(props) {
|
|
1444
|
-
let
|
|
1445
|
-
suspenseSetter,
|
|
1446
|
-
showContent,
|
|
1447
|
-
showFallback;
|
|
1455
|
+
let suspenseSetter, showContent, showFallback;
|
|
1448
1456
|
const listContext = useContext(SuspenseListContext);
|
|
1449
1457
|
if (listContext) {
|
|
1450
1458
|
const [inFallback, setFallback] = createSignal(false);
|
|
1451
1459
|
suspenseSetter = setFallback;
|
|
1452
1460
|
[showContent, showFallback] = listContext.register(inFallback);
|
|
1453
1461
|
}
|
|
1454
|
-
const registry = [],
|
|
1462
|
+
const [registry, setRegistry] = createSignal([]),
|
|
1455
1463
|
comp = createComponent(SuspenseListContext.Provider, {
|
|
1456
1464
|
value: {
|
|
1457
1465
|
register: inFallback => {
|
|
1458
1466
|
const [showingContent, showContent] = createSignal(false),
|
|
1459
1467
|
[showingFallback, showFallback] = createSignal(false);
|
|
1460
|
-
registry[
|
|
1468
|
+
setRegistry(registry => [...registry, {
|
|
1461
1469
|
inFallback,
|
|
1462
1470
|
showContent,
|
|
1463
1471
|
showFallback
|
|
1464
|
-
};
|
|
1472
|
+
}]);
|
|
1465
1473
|
return [showingContent, showingFallback];
|
|
1466
1474
|
}
|
|
1467
1475
|
},
|
|
@@ -1474,31 +1482,32 @@ function SuspenseList(props) {
|
|
|
1474
1482
|
tail = props.tail,
|
|
1475
1483
|
visibleContent = showContent ? showContent() : true,
|
|
1476
1484
|
visibleFallback = showFallback ? showFallback() : true,
|
|
1485
|
+
reg = registry(),
|
|
1477
1486
|
reverse = reveal === "backwards";
|
|
1478
1487
|
if (reveal === "together") {
|
|
1479
|
-
const all =
|
|
1488
|
+
const all = reg.every(i => !i.inFallback());
|
|
1480
1489
|
suspenseSetter && suspenseSetter(!all);
|
|
1481
|
-
|
|
1490
|
+
reg.forEach(i => {
|
|
1482
1491
|
i.showContent(all && visibleContent);
|
|
1483
1492
|
i.showFallback(visibleFallback);
|
|
1484
1493
|
});
|
|
1485
1494
|
return;
|
|
1486
1495
|
}
|
|
1487
1496
|
let stop = false;
|
|
1488
|
-
for (let i = 0, len =
|
|
1497
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1489
1498
|
const n = reverse ? len - i - 1 : i,
|
|
1490
|
-
s =
|
|
1499
|
+
s = reg[n].inFallback();
|
|
1491
1500
|
if (!stop && !s) {
|
|
1492
|
-
|
|
1493
|
-
|
|
1501
|
+
reg[n].showContent(visibleContent);
|
|
1502
|
+
reg[n].showFallback(visibleFallback);
|
|
1494
1503
|
} else {
|
|
1495
1504
|
const next = !stop;
|
|
1496
1505
|
if (next && suspenseSetter) suspenseSetter(true);
|
|
1497
1506
|
if (!tail || next && tail === "collapsed") {
|
|
1498
|
-
|
|
1499
|
-
} else
|
|
1507
|
+
reg[n].showFallback(visibleFallback);
|
|
1508
|
+
} else reg[n].showFallback(false);
|
|
1500
1509
|
stop = true;
|
|
1501
|
-
|
|
1510
|
+
reg[n].showContent(next);
|
|
1502
1511
|
}
|
|
1503
1512
|
}
|
|
1504
1513
|
if (!stop && suspenseSetter) suspenseSetter(false);
|
|
@@ -1527,7 +1536,7 @@ function Suspense(props) {
|
|
|
1527
1536
|
resolved: false
|
|
1528
1537
|
},
|
|
1529
1538
|
owner = getOwner();
|
|
1530
|
-
if (sharedConfig.context) {
|
|
1539
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1531
1540
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1532
1541
|
p = sharedConfig.load(key);
|
|
1533
1542
|
if (p) {
|
|
@@ -1560,7 +1569,7 @@ function Suspense(props) {
|
|
|
1560
1569
|
return flicker = undefined;
|
|
1561
1570
|
}
|
|
1562
1571
|
if (ctx && p === undefined) setHydrateContext();
|
|
1563
|
-
const rendered =
|
|
1572
|
+
const rendered = createMemo(() => props.children);
|
|
1564
1573
|
return createMemo(() => {
|
|
1565
1574
|
const inFallback = store.inFallback(),
|
|
1566
1575
|
visibleContent = showContent ? showContent() : true,
|
|
@@ -1570,7 +1579,7 @@ function Suspense(props) {
|
|
|
1570
1579
|
store.resolved = true;
|
|
1571
1580
|
ctx = p = undefined;
|
|
1572
1581
|
resumeEffects(store.effects);
|
|
1573
|
-
return rendered;
|
|
1582
|
+
return rendered();
|
|
1574
1583
|
}
|
|
1575
1584
|
if (!visibleFallback) return;
|
|
1576
1585
|
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;
|
|
@@ -820,14 +827,16 @@ function completeUpdates(wait) {
|
|
|
820
827
|
return;
|
|
821
828
|
}
|
|
822
829
|
const sources = Transition.sources;
|
|
830
|
+
const disposed = Transition.disposed;
|
|
823
831
|
res = Transition.resolve;
|
|
824
|
-
|
|
832
|
+
for (const e of Effects) {
|
|
825
833
|
"tState" in e && (e.state = e.tState);
|
|
826
834
|
delete e.tState;
|
|
827
|
-
}
|
|
835
|
+
}
|
|
828
836
|
Transition = null;
|
|
829
837
|
batch(() => {
|
|
830
|
-
|
|
838
|
+
for (const d of disposed) cleanNode(d);
|
|
839
|
+
for (const v of sources) {
|
|
831
840
|
v.value = v.tValue;
|
|
832
841
|
if (v.owned) {
|
|
833
842
|
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
@@ -836,7 +845,7 @@ function completeUpdates(wait) {
|
|
|
836
845
|
delete v.tValue;
|
|
837
846
|
delete v.tOwned;
|
|
838
847
|
v.tState = 0;
|
|
839
|
-
}
|
|
848
|
+
}
|
|
840
849
|
setTransPending(false);
|
|
841
850
|
});
|
|
842
851
|
}
|
|
@@ -942,6 +951,7 @@ function cleanNode(node) {
|
|
|
942
951
|
}
|
|
943
952
|
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
944
953
|
node.context = null;
|
|
954
|
+
delete node.sourceMap;
|
|
945
955
|
}
|
|
946
956
|
function reset(node, top) {
|
|
947
957
|
if (!top) {
|
|
@@ -955,7 +965,7 @@ function reset(node, top) {
|
|
|
955
965
|
function handleError(err) {
|
|
956
966
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
957
967
|
if (!fns) throw err;
|
|
958
|
-
|
|
968
|
+
for (const f of fns) f(err);
|
|
959
969
|
}
|
|
960
970
|
function lookup(owner, key) {
|
|
961
971
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1411,24 +1421,25 @@ function Match(props) {
|
|
|
1411
1421
|
return props;
|
|
1412
1422
|
}
|
|
1413
1423
|
let Errors;
|
|
1424
|
+
const NoErrors = {};
|
|
1414
1425
|
function resetErrorBoundaries() {
|
|
1415
|
-
Errors && [...Errors].forEach(fn => fn());
|
|
1426
|
+
Errors && [...Errors].forEach(fn => fn(NoErrors));
|
|
1416
1427
|
}
|
|
1417
1428
|
function ErrorBoundary(props) {
|
|
1418
|
-
let err =
|
|
1429
|
+
let err = NoErrors;
|
|
1419
1430
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1420
|
-
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1431
|
+
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count) || NoErrors;
|
|
1421
1432
|
}
|
|
1422
1433
|
const [errored, setErrored] = createSignal(err);
|
|
1423
1434
|
Errors || (Errors = new Set());
|
|
1424
1435
|
Errors.add(setErrored);
|
|
1425
1436
|
onCleanup(() => Errors.delete(setErrored));
|
|
1426
|
-
let e;
|
|
1427
1437
|
return createMemo(() => {
|
|
1428
|
-
|
|
1438
|
+
let e;
|
|
1439
|
+
if ((e = errored()) !== NoErrors) {
|
|
1429
1440
|
const f = props.fallback;
|
|
1430
1441
|
if ((typeof f !== "function" || f.length == 0)) console.error(e);
|
|
1431
|
-
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(
|
|
1442
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(NoErrors))) : f;
|
|
1432
1443
|
}
|
|
1433
1444
|
onError(setErrored);
|
|
1434
1445
|
return props.children;
|
|
@@ -1437,27 +1448,24 @@ function ErrorBoundary(props) {
|
|
|
1437
1448
|
|
|
1438
1449
|
const SuspenseListContext = createContext();
|
|
1439
1450
|
function SuspenseList(props) {
|
|
1440
|
-
let
|
|
1441
|
-
suspenseSetter,
|
|
1442
|
-
showContent,
|
|
1443
|
-
showFallback;
|
|
1451
|
+
let suspenseSetter, showContent, showFallback;
|
|
1444
1452
|
const listContext = useContext(SuspenseListContext);
|
|
1445
1453
|
if (listContext) {
|
|
1446
1454
|
const [inFallback, setFallback] = createSignal(false);
|
|
1447
1455
|
suspenseSetter = setFallback;
|
|
1448
1456
|
[showContent, showFallback] = listContext.register(inFallback);
|
|
1449
1457
|
}
|
|
1450
|
-
const registry = [],
|
|
1458
|
+
const [registry, setRegistry] = createSignal([]),
|
|
1451
1459
|
comp = createComponent(SuspenseListContext.Provider, {
|
|
1452
1460
|
value: {
|
|
1453
1461
|
register: inFallback => {
|
|
1454
1462
|
const [showingContent, showContent] = createSignal(false),
|
|
1455
1463
|
[showingFallback, showFallback] = createSignal(false);
|
|
1456
|
-
registry[
|
|
1464
|
+
setRegistry(registry => [...registry, {
|
|
1457
1465
|
inFallback,
|
|
1458
1466
|
showContent,
|
|
1459
1467
|
showFallback
|
|
1460
|
-
};
|
|
1468
|
+
}]);
|
|
1461
1469
|
return [showingContent, showingFallback];
|
|
1462
1470
|
}
|
|
1463
1471
|
},
|
|
@@ -1470,31 +1478,32 @@ function SuspenseList(props) {
|
|
|
1470
1478
|
tail = props.tail,
|
|
1471
1479
|
visibleContent = showContent ? showContent() : true,
|
|
1472
1480
|
visibleFallback = showFallback ? showFallback() : true,
|
|
1481
|
+
reg = registry(),
|
|
1473
1482
|
reverse = reveal === "backwards";
|
|
1474
1483
|
if (reveal === "together") {
|
|
1475
|
-
const all =
|
|
1484
|
+
const all = reg.every(i => !i.inFallback());
|
|
1476
1485
|
suspenseSetter && suspenseSetter(!all);
|
|
1477
|
-
|
|
1486
|
+
reg.forEach(i => {
|
|
1478
1487
|
i.showContent(all && visibleContent);
|
|
1479
1488
|
i.showFallback(visibleFallback);
|
|
1480
1489
|
});
|
|
1481
1490
|
return;
|
|
1482
1491
|
}
|
|
1483
1492
|
let stop = false;
|
|
1484
|
-
for (let i = 0, len =
|
|
1493
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1485
1494
|
const n = reverse ? len - i - 1 : i,
|
|
1486
|
-
s =
|
|
1495
|
+
s = reg[n].inFallback();
|
|
1487
1496
|
if (!stop && !s) {
|
|
1488
|
-
|
|
1489
|
-
|
|
1497
|
+
reg[n].showContent(visibleContent);
|
|
1498
|
+
reg[n].showFallback(visibleFallback);
|
|
1490
1499
|
} else {
|
|
1491
1500
|
const next = !stop;
|
|
1492
1501
|
if (next && suspenseSetter) suspenseSetter(true);
|
|
1493
1502
|
if (!tail || next && tail === "collapsed") {
|
|
1494
|
-
|
|
1495
|
-
} else
|
|
1503
|
+
reg[n].showFallback(visibleFallback);
|
|
1504
|
+
} else reg[n].showFallback(false);
|
|
1496
1505
|
stop = true;
|
|
1497
|
-
|
|
1506
|
+
reg[n].showContent(next);
|
|
1498
1507
|
}
|
|
1499
1508
|
}
|
|
1500
1509
|
if (!stop && suspenseSetter) suspenseSetter(false);
|
|
@@ -1523,7 +1532,7 @@ function Suspense(props) {
|
|
|
1523
1532
|
resolved: false
|
|
1524
1533
|
},
|
|
1525
1534
|
owner = getOwner();
|
|
1526
|
-
if (sharedConfig.context) {
|
|
1535
|
+
if (sharedConfig.context && sharedConfig.load) {
|
|
1527
1536
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1528
1537
|
p = sharedConfig.load(key);
|
|
1529
1538
|
if (p) {
|
|
@@ -1556,7 +1565,7 @@ function Suspense(props) {
|
|
|
1556
1565
|
return flicker = undefined;
|
|
1557
1566
|
}
|
|
1558
1567
|
if (ctx && p === undefined) setHydrateContext();
|
|
1559
|
-
const rendered =
|
|
1568
|
+
const rendered = createMemo(() => props.children);
|
|
1560
1569
|
return createMemo(() => {
|
|
1561
1570
|
const inFallback = store.inFallback(),
|
|
1562
1571
|
visibleContent = showContent ? showContent() : true,
|
|
@@ -1566,7 +1575,7 @@ function Suspense(props) {
|
|
|
1566
1575
|
store.resolved = true;
|
|
1567
1576
|
ctx = p = undefined;
|
|
1568
1577
|
resumeEffects(store.effects);
|
|
1569
|
-
return rendered;
|
|
1578
|
+
return rendered();
|
|
1570
1579
|
}
|
|
1571
1580
|
if (!visibleFallback) return;
|
|
1572
1581
|
return createRoot(disposer => {
|
package/dist/server.cjs
CHANGED
|
@@ -258,8 +258,9 @@ function createComponent(Comp, props) {
|
|
|
258
258
|
function mergeProps(...sources) {
|
|
259
259
|
const target = {};
|
|
260
260
|
for (let i = 0; i < sources.length; i++) {
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
let source = sources[i];
|
|
262
|
+
if (typeof source === "function") source = source();
|
|
263
|
+
if (source) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
263
264
|
}
|
|
264
265
|
return target;
|
|
265
266
|
}
|
|
@@ -314,14 +315,16 @@ function Switch(props) {
|
|
|
314
315
|
function Match(props) {
|
|
315
316
|
return props;
|
|
316
317
|
}
|
|
318
|
+
const NoErrors = {};
|
|
317
319
|
function resetErrorBoundaries() {}
|
|
318
320
|
function ErrorBoundary(props) {
|
|
319
|
-
let error,
|
|
321
|
+
let error = NoErrors,
|
|
322
|
+
res;
|
|
320
323
|
const ctx = sharedConfig.context;
|
|
321
324
|
const id = ctx.id + ctx.count;
|
|
322
325
|
onError(err => error = err);
|
|
323
326
|
createMemo(() => res = props.children);
|
|
324
|
-
if (error) {
|
|
327
|
+
if (error !== NoErrors) {
|
|
325
328
|
ctx.writeResource(id, error, true);
|
|
326
329
|
setHydrateContext({ ...ctx,
|
|
327
330
|
count: 0
|
|
@@ -360,7 +363,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
360
363
|
const read = () => {
|
|
361
364
|
if (error) throw error;
|
|
362
365
|
if (resourceContext && p) resourceContext.push(p);
|
|
363
|
-
const resolved = sharedConfig.context.async && sharedConfig.context.resources[id]
|
|
366
|
+
const resolved = sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
|
|
364
367
|
if (!resolved && read.loading) {
|
|
365
368
|
const ctx = useContext(SuspenseContext);
|
|
366
369
|
if (ctx) {
|
|
@@ -380,7 +383,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
380
383
|
function load() {
|
|
381
384
|
const ctx = sharedConfig.context;
|
|
382
385
|
if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
|
|
383
|
-
if (ctx.resources && id in ctx.resources && ctx.resources[id]
|
|
386
|
+
if (ctx.resources && id in ctx.resources && "data" in ctx.resources[id]) {
|
|
384
387
|
value = ctx.resources[id].data;
|
|
385
388
|
return;
|
|
386
389
|
}
|
package/dist/server.js
CHANGED
|
@@ -254,8 +254,9 @@ function createComponent(Comp, props) {
|
|
|
254
254
|
function mergeProps(...sources) {
|
|
255
255
|
const target = {};
|
|
256
256
|
for (let i = 0; i < sources.length; i++) {
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
let source = sources[i];
|
|
258
|
+
if (typeof source === "function") source = source();
|
|
259
|
+
if (source) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
259
260
|
}
|
|
260
261
|
return target;
|
|
261
262
|
}
|
|
@@ -310,14 +311,16 @@ function Switch(props) {
|
|
|
310
311
|
function Match(props) {
|
|
311
312
|
return props;
|
|
312
313
|
}
|
|
314
|
+
const NoErrors = {};
|
|
313
315
|
function resetErrorBoundaries() {}
|
|
314
316
|
function ErrorBoundary(props) {
|
|
315
|
-
let error,
|
|
317
|
+
let error = NoErrors,
|
|
318
|
+
res;
|
|
316
319
|
const ctx = sharedConfig.context;
|
|
317
320
|
const id = ctx.id + ctx.count;
|
|
318
321
|
onError(err => error = err);
|
|
319
322
|
createMemo(() => res = props.children);
|
|
320
|
-
if (error) {
|
|
323
|
+
if (error !== NoErrors) {
|
|
321
324
|
ctx.writeResource(id, error, true);
|
|
322
325
|
setHydrateContext({ ...ctx,
|
|
323
326
|
count: 0
|
|
@@ -356,7 +359,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
356
359
|
const read = () => {
|
|
357
360
|
if (error) throw error;
|
|
358
361
|
if (resourceContext && p) resourceContext.push(p);
|
|
359
|
-
const resolved = sharedConfig.context.async && sharedConfig.context.resources[id]
|
|
362
|
+
const resolved = sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
|
|
360
363
|
if (!resolved && read.loading) {
|
|
361
364
|
const ctx = useContext(SuspenseContext);
|
|
362
365
|
if (ctx) {
|
|
@@ -376,7 +379,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
376
379
|
function load() {
|
|
377
380
|
const ctx = sharedConfig.context;
|
|
378
381
|
if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
|
|
379
|
-
if (ctx.resources && id in ctx.resources && ctx.resources[id]
|
|
382
|
+
if (ctx.resources && id in ctx.resources && "data" in ctx.resources[id]) {
|
|
380
383
|
value = ctx.resources[id].data;
|
|
381
384
|
return;
|
|
382
385
|
}
|