solid-js 1.8.1 → 1.8.2
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 +5 -1
- package/dist/dev.js +301 -532
- package/dist/server.cjs +18 -4
- package/dist/server.js +89 -170
- package/dist/solid.cjs +5 -1
- package/dist/solid.js +259 -459
- package/h/dist/h.js +8 -34
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +31 -45
- package/package.json +2 -2
- package/store/dist/dev.js +42 -114
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +39 -105
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +9 -72
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +140 -228
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +31 -62
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +14 -14
- package/types/server/index.d.ts +2 -56
- package/types/server/reactive.d.ts +44 -68
- package/types/server/rendering.d.ts +95 -166
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.js +81 -617
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +93 -176
- package/web/dist/web.js +80 -611
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
package/dist/server.cjs
CHANGED
|
@@ -220,11 +220,19 @@ function requestCallback(fn, options) {
|
|
|
220
220
|
function mapArray(list, mapFn, options = {}) {
|
|
221
221
|
const items = list();
|
|
222
222
|
let s = [];
|
|
223
|
-
if (items.length) {
|
|
223
|
+
if (items && items.length) {
|
|
224
224
|
for (let i = 0, len = items.length; i < len; i++) s.push(mapFn(items[i], () => i));
|
|
225
225
|
} else if (options.fallback) s = [options.fallback()];
|
|
226
226
|
return () => s;
|
|
227
227
|
}
|
|
228
|
+
function indexArray(list, mapFn, options = {}) {
|
|
229
|
+
const items = list();
|
|
230
|
+
let s = [];
|
|
231
|
+
if (items && items.length) {
|
|
232
|
+
for (let i = 0, len = items.length; i < len; i++) s.push(mapFn(() => items[i], i));
|
|
233
|
+
} else if (options.fallback) s = [options.fallback()];
|
|
234
|
+
return () => s;
|
|
235
|
+
}
|
|
228
236
|
function observable(input) {
|
|
229
237
|
return {
|
|
230
238
|
subscribe(observer) {
|
|
@@ -513,8 +521,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
513
521
|
if (p != undefined && typeof p === "object" && "then" in p) {
|
|
514
522
|
read.loading = true;
|
|
515
523
|
read.state = "pending";
|
|
516
|
-
|
|
517
|
-
return p.then(res => {
|
|
524
|
+
p = p.then(res => {
|
|
518
525
|
read.loading = false;
|
|
519
526
|
read.state = "ready";
|
|
520
527
|
ctx.resources[id].data = res;
|
|
@@ -527,7 +534,10 @@ function createResource(source, fetcher, options = {}) {
|
|
|
527
534
|
read.error = error = castError(err);
|
|
528
535
|
p = null;
|
|
529
536
|
notifySuspense(contexts);
|
|
537
|
+
throw error;
|
|
530
538
|
});
|
|
539
|
+
if (ctx.serialize) ctx.serialize(id, p, options.deferStream);
|
|
540
|
+
return p;
|
|
531
541
|
}
|
|
532
542
|
ctx.resources[id].data = p;
|
|
533
543
|
if (ctx.serialize) ctx.serialize(id, p);
|
|
@@ -639,7 +649,10 @@ function Suspense(props) {
|
|
|
639
649
|
}));
|
|
640
650
|
}
|
|
641
651
|
const res = runSuspense();
|
|
642
|
-
if (suspenseComplete(value))
|
|
652
|
+
if (suspenseComplete(value)) {
|
|
653
|
+
delete ctx.suspense[id];
|
|
654
|
+
return res;
|
|
655
|
+
}
|
|
643
656
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
644
657
|
return catchError(() => {
|
|
645
658
|
if (ctx.async) {
|
|
@@ -700,6 +713,7 @@ exports.equalFn = equalFn;
|
|
|
700
713
|
exports.from = from;
|
|
701
714
|
exports.getListener = getListener;
|
|
702
715
|
exports.getOwner = getOwner;
|
|
716
|
+
exports.indexArray = indexArray;
|
|
703
717
|
exports.lazy = lazy;
|
|
704
718
|
exports.mapArray = mapArray;
|
|
705
719
|
exports.mergeProps = mergeProps;
|
package/dist/server.js
CHANGED
|
@@ -17,7 +17,7 @@ function handleError(err, owner = Owner) {
|
|
|
17
17
|
try {
|
|
18
18
|
for (const f of fns) f(error);
|
|
19
19
|
} catch (e) {
|
|
20
|
-
handleError(e,
|
|
20
|
+
handleError(e, owner && owner.owner || null);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
const UNOWNED = {
|
|
@@ -35,23 +35,19 @@ function createOwner() {
|
|
|
35
35
|
cleanups: null
|
|
36
36
|
};
|
|
37
37
|
if (Owner) {
|
|
38
|
-
if (!Owner.owned) Owner.owned = [o];
|
|
39
|
-
else Owner.owned.push(o);
|
|
38
|
+
if (!Owner.owned) Owner.owned = [o];else Owner.owned.push(o);
|
|
40
39
|
}
|
|
41
40
|
return o;
|
|
42
41
|
}
|
|
43
42
|
function createRoot(fn, detachedOwner) {
|
|
44
43
|
const owner = Owner,
|
|
45
44
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
46
|
-
root =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
owned: null,
|
|
53
|
-
cleanups: null
|
|
54
|
-
};
|
|
45
|
+
root = fn.length === 0 ? UNOWNED : {
|
|
46
|
+
context: current ? current.context : null,
|
|
47
|
+
owner: current,
|
|
48
|
+
owned: null,
|
|
49
|
+
cleanups: null
|
|
50
|
+
};
|
|
55
51
|
Owner = root;
|
|
56
52
|
let result;
|
|
57
53
|
try {
|
|
@@ -64,12 +60,9 @@ function createRoot(fn, detachedOwner) {
|
|
|
64
60
|
return result;
|
|
65
61
|
}
|
|
66
62
|
function createSignal(value, options) {
|
|
67
|
-
return [
|
|
68
|
-
()
|
|
69
|
-
|
|
70
|
-
return (value = typeof v === "function" ? v(value) : v);
|
|
71
|
-
}
|
|
72
|
-
];
|
|
63
|
+
return [() => value, v => {
|
|
64
|
+
return value = typeof v === "function" ? v(value) : v;
|
|
65
|
+
}];
|
|
73
66
|
}
|
|
74
67
|
function createComputed(fn, value) {
|
|
75
68
|
Owner = createOwner();
|
|
@@ -126,8 +119,7 @@ function on(deps, fn, options = {}) {
|
|
|
126
119
|
function onMount(fn) {}
|
|
127
120
|
function onCleanup(fn) {
|
|
128
121
|
if (Owner) {
|
|
129
|
-
if (!Owner.cleanups) Owner.cleanups = [fn];
|
|
130
|
-
else Owner.cleanups.push(fn);
|
|
122
|
+
if (!Owner.cleanups) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
131
123
|
}
|
|
132
124
|
return fn;
|
|
133
125
|
}
|
|
@@ -168,9 +160,7 @@ function createContext(defaultValue) {
|
|
|
168
160
|
};
|
|
169
161
|
}
|
|
170
162
|
function useContext(context) {
|
|
171
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
172
|
-
? Owner.context[context.id]
|
|
173
|
-
: context.defaultValue;
|
|
163
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
174
164
|
}
|
|
175
165
|
function getOwner() {
|
|
176
166
|
return Owner;
|
|
@@ -228,19 +218,26 @@ function requestCallback(fn, options) {
|
|
|
228
218
|
function mapArray(list, mapFn, options = {}) {
|
|
229
219
|
const items = list();
|
|
230
220
|
let s = [];
|
|
231
|
-
if (items.length) {
|
|
221
|
+
if (items && items.length) {
|
|
232
222
|
for (let i = 0, len = items.length; i < len; i++) s.push(mapFn(items[i], () => i));
|
|
233
223
|
} else if (options.fallback) s = [options.fallback()];
|
|
234
224
|
return () => s;
|
|
235
225
|
}
|
|
226
|
+
function indexArray(list, mapFn, options = {}) {
|
|
227
|
+
const items = list();
|
|
228
|
+
let s = [];
|
|
229
|
+
if (items && items.length) {
|
|
230
|
+
for (let i = 0, len = items.length; i < len; i++) s.push(mapFn(() => items[i], i));
|
|
231
|
+
} else if (options.fallback) s = [options.fallback()];
|
|
232
|
+
return () => s;
|
|
233
|
+
}
|
|
236
234
|
function observable(input) {
|
|
237
235
|
return {
|
|
238
236
|
subscribe(observer) {
|
|
239
237
|
if (!(observer instanceof Object) || observer == null) {
|
|
240
238
|
throw new TypeError("Expected the observer to be an object.");
|
|
241
239
|
}
|
|
242
|
-
const handler =
|
|
243
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
240
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
244
241
|
if (!handler) {
|
|
245
242
|
return {
|
|
246
243
|
unsubscribe() {}
|
|
@@ -269,7 +266,7 @@ function from(producer) {
|
|
|
269
266
|
const [s, set] = createSignal(undefined);
|
|
270
267
|
if ("subscribe" in producer) {
|
|
271
268
|
const unsub = producer.subscribe(v => set(() => v));
|
|
272
|
-
onCleanup(() =>
|
|
269
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
273
270
|
} else {
|
|
274
271
|
const clean = producer(set);
|
|
275
272
|
onCleanup(clean);
|
|
@@ -321,13 +318,11 @@ function setHydrateContext(context) {
|
|
|
321
318
|
sharedConfig.context = context;
|
|
322
319
|
}
|
|
323
320
|
function nextHydrateContext() {
|
|
324
|
-
return sharedConfig.context
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
: undefined;
|
|
321
|
+
return sharedConfig.context ? {
|
|
322
|
+
...sharedConfig.context,
|
|
323
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
324
|
+
count: 0
|
|
325
|
+
} : undefined;
|
|
331
326
|
}
|
|
332
327
|
function createUniqueId() {
|
|
333
328
|
const ctx = sharedConfig.context;
|
|
@@ -404,11 +399,7 @@ function Index(props) {
|
|
|
404
399
|
}
|
|
405
400
|
function Show(props) {
|
|
406
401
|
let c;
|
|
407
|
-
return props.when
|
|
408
|
-
? typeof (c = props.children) === "function"
|
|
409
|
-
? c(props.keyed ? props.when : () => props.when)
|
|
410
|
-
: c
|
|
411
|
-
: props.fallback || "";
|
|
402
|
+
return props.when ? typeof (c = props.children) === "function" ? c(props.keyed ? props.when : () => props.when) : c : props.fallback || "";
|
|
412
403
|
}
|
|
413
404
|
function Switch(props) {
|
|
414
405
|
let conditions = props.children;
|
|
@@ -445,14 +436,11 @@ function ErrorBoundary(props) {
|
|
|
445
436
|
}
|
|
446
437
|
createMemo(() => {
|
|
447
438
|
clean = Owner;
|
|
448
|
-
return catchError(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
sync = true;
|
|
454
|
-
}
|
|
455
|
-
);
|
|
439
|
+
return catchError(() => res = props.children, err => {
|
|
440
|
+
error = err;
|
|
441
|
+
!sync && ctx.replace("e" + id, displayFallback);
|
|
442
|
+
sync = true;
|
|
443
|
+
});
|
|
456
444
|
});
|
|
457
445
|
if (error) return displayFallback();
|
|
458
446
|
sync = false;
|
|
@@ -482,18 +470,14 @@ function createResource(source, fetcher, options = {}) {
|
|
|
482
470
|
if (sharedConfig.context.async && options.ssrLoadFrom !== "initial") {
|
|
483
471
|
resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
|
|
484
472
|
if (resource.ref) {
|
|
485
|
-
if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error)
|
|
486
|
-
resource.ref[1].refetch();
|
|
473
|
+
if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
|
|
487
474
|
return resource.ref;
|
|
488
475
|
}
|
|
489
476
|
}
|
|
490
477
|
const read = () => {
|
|
491
478
|
if (error) throw error;
|
|
492
479
|
if (resourceContext && p) resourceContext.push(p);
|
|
493
|
-
const resolved =
|
|
494
|
-
options.ssrLoadFrom !== "initial" &&
|
|
495
|
-
sharedConfig.context.async &&
|
|
496
|
-
"data" in sharedConfig.context.resources[id];
|
|
480
|
+
const resolved = options.ssrLoadFrom !== "initial" && sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
|
|
497
481
|
if (!resolved && read.loading) {
|
|
498
482
|
const ctx = useContext(SuspenseContext);
|
|
499
483
|
if (ctx) {
|
|
@@ -513,7 +497,7 @@ function createResource(source, fetcher, options = {}) {
|
|
|
513
497
|
});
|
|
514
498
|
function load() {
|
|
515
499
|
const ctx = sharedConfig.context;
|
|
516
|
-
if (!ctx.async) return
|
|
500
|
+
if (!ctx.async) return read.loading = !!(typeof source === "function" ? source() : source);
|
|
517
501
|
if (ctx.resources && id in ctx.resources && "data" in ctx.resources[id]) {
|
|
518
502
|
value = ctx.resources[id].data;
|
|
519
503
|
return;
|
|
@@ -521,11 +505,9 @@ function createResource(source, fetcher, options = {}) {
|
|
|
521
505
|
resourceContext = [];
|
|
522
506
|
const lookup = typeof source === "function" ? source() : source;
|
|
523
507
|
if (resourceContext.length) {
|
|
524
|
-
p = Promise.all(resourceContext).then(() =>
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
})
|
|
528
|
-
);
|
|
508
|
+
p = Promise.all(resourceContext).then(() => fetcher(source(), {
|
|
509
|
+
value
|
|
510
|
+
}));
|
|
529
511
|
}
|
|
530
512
|
resourceContext = null;
|
|
531
513
|
if (!p) {
|
|
@@ -537,23 +519,23 @@ function createResource(source, fetcher, options = {}) {
|
|
|
537
519
|
if (p != undefined && typeof p === "object" && "then" in p) {
|
|
538
520
|
read.loading = true;
|
|
539
521
|
read.state = "pending";
|
|
522
|
+
p = p.then(res => {
|
|
523
|
+
read.loading = false;
|
|
524
|
+
read.state = "ready";
|
|
525
|
+
ctx.resources[id].data = res;
|
|
526
|
+
p = null;
|
|
527
|
+
notifySuspense(contexts);
|
|
528
|
+
return res;
|
|
529
|
+
}).catch(err => {
|
|
530
|
+
read.loading = false;
|
|
531
|
+
read.state = "errored";
|
|
532
|
+
read.error = error = castError(err);
|
|
533
|
+
p = null;
|
|
534
|
+
notifySuspense(contexts);
|
|
535
|
+
throw error;
|
|
536
|
+
});
|
|
540
537
|
if (ctx.serialize) ctx.serialize(id, p, options.deferStream);
|
|
541
|
-
return p
|
|
542
|
-
.then(res => {
|
|
543
|
-
read.loading = false;
|
|
544
|
-
read.state = "ready";
|
|
545
|
-
ctx.resources[id].data = res;
|
|
546
|
-
p = null;
|
|
547
|
-
notifySuspense(contexts);
|
|
548
|
-
return res;
|
|
549
|
-
})
|
|
550
|
-
.catch(err => {
|
|
551
|
-
read.loading = false;
|
|
552
|
-
read.state = "errored";
|
|
553
|
-
read.error = error = castError(err);
|
|
554
|
-
p = null;
|
|
555
|
-
notifySuspense(contexts);
|
|
556
|
-
});
|
|
538
|
+
return p;
|
|
557
539
|
}
|
|
558
540
|
ctx.resources[id].data = p;
|
|
559
541
|
if (ctx.serialize) ctx.serialize(id, p);
|
|
@@ -561,20 +543,17 @@ function createResource(source, fetcher, options = {}) {
|
|
|
561
543
|
return ctx.resources[id].data;
|
|
562
544
|
}
|
|
563
545
|
if (options.ssrLoadFrom !== "initial") load();
|
|
564
|
-
return
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
mutate: v => (value = v)
|
|
569
|
-
}
|
|
570
|
-
]);
|
|
546
|
+
return resource.ref = [read, {
|
|
547
|
+
refetch: load,
|
|
548
|
+
mutate: v => value = v
|
|
549
|
+
}];
|
|
571
550
|
}
|
|
572
551
|
function lazy(fn) {
|
|
573
552
|
let p;
|
|
574
553
|
let load = id => {
|
|
575
554
|
if (!p) {
|
|
576
555
|
p = fn();
|
|
577
|
-
p.then(mod =>
|
|
556
|
+
p.then(mod => p.resolved = mod.default);
|
|
578
557
|
if (id) sharedConfig.context.lazy[id] = p;
|
|
579
558
|
}
|
|
580
559
|
return p;
|
|
@@ -583,8 +562,7 @@ function lazy(fn) {
|
|
|
583
562
|
const wrap = props => {
|
|
584
563
|
const id = sharedConfig.context.id.slice(0, -1);
|
|
585
564
|
let ref = sharedConfig.context.lazy[id];
|
|
586
|
-
if (ref) p = ref;
|
|
587
|
-
else load(id);
|
|
565
|
+
if (ref) p = ref;else load(id);
|
|
588
566
|
if (p.resolved) return p.resolved(props);
|
|
589
567
|
const ctx = useContext(SuspenseContext);
|
|
590
568
|
const track = {
|
|
@@ -596,12 +574,10 @@ function lazy(fn) {
|
|
|
596
574
|
contexts.add(ctx);
|
|
597
575
|
}
|
|
598
576
|
if (sharedConfig.context.async) {
|
|
599
|
-
sharedConfig.context.block(
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
})
|
|
604
|
-
);
|
|
577
|
+
sharedConfig.context.block(p.then(() => {
|
|
578
|
+
track.loading = false;
|
|
579
|
+
notifySuspense(contexts);
|
|
580
|
+
}));
|
|
605
581
|
}
|
|
606
582
|
return "";
|
|
607
583
|
};
|
|
@@ -629,12 +605,9 @@ function startTransition(fn) {
|
|
|
629
605
|
fn();
|
|
630
606
|
}
|
|
631
607
|
function useTransition() {
|
|
632
|
-
return [
|
|
633
|
-
()
|
|
634
|
-
|
|
635
|
-
fn();
|
|
636
|
-
}
|
|
637
|
-
];
|
|
608
|
+
return [() => false, fn => {
|
|
609
|
+
fn();
|
|
610
|
+
}];
|
|
638
611
|
}
|
|
639
612
|
function SuspenseList(props) {
|
|
640
613
|
return props.children;
|
|
@@ -644,17 +617,15 @@ function Suspense(props) {
|
|
|
644
617
|
const ctx = sharedConfig.context;
|
|
645
618
|
const id = ctx.id + ctx.count;
|
|
646
619
|
const o = createOwner();
|
|
647
|
-
const value =
|
|
648
|
-
|
|
649
|
-
(
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
if (suspenseComplete(value)) {
|
|
654
|
-
done(resolveSSRNode(res));
|
|
655
|
-
}
|
|
620
|
+
const value = ctx.suspense[id] || (ctx.suspense[id] = {
|
|
621
|
+
resources: new Map(),
|
|
622
|
+
completed: () => {
|
|
623
|
+
const res = runSuspense();
|
|
624
|
+
if (suspenseComplete(value)) {
|
|
625
|
+
done(resolveSSRNode(res));
|
|
656
626
|
}
|
|
657
|
-
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
658
629
|
function suspenseError(err) {
|
|
659
630
|
if (!done || !done(undefined, err)) {
|
|
660
631
|
runWithOwner(o.owner, () => {
|
|
@@ -668,17 +639,18 @@ function Suspense(props) {
|
|
|
668
639
|
count: 0
|
|
669
640
|
});
|
|
670
641
|
cleanNode(o);
|
|
671
|
-
return runWithOwner(o, () =>
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
})
|
|
678
|
-
);
|
|
642
|
+
return runWithOwner(o, () => createComponent(SuspenseContext.Provider, {
|
|
643
|
+
value,
|
|
644
|
+
get children() {
|
|
645
|
+
return catchError(() => props.children, suspenseError);
|
|
646
|
+
}
|
|
647
|
+
}));
|
|
679
648
|
}
|
|
680
649
|
const res = runSuspense();
|
|
681
|
-
if (suspenseComplete(value))
|
|
650
|
+
if (suspenseComplete(value)) {
|
|
651
|
+
delete ctx.suspense[id];
|
|
652
|
+
return res;
|
|
653
|
+
}
|
|
682
654
|
done = ctx.async ? ctx.registerFragment(id) : undefined;
|
|
683
655
|
return catchError(() => {
|
|
684
656
|
if (ctx.async) {
|
|
@@ -704,57 +676,4 @@ function Suspense(props) {
|
|
|
704
676
|
}, suspenseError);
|
|
705
677
|
}
|
|
706
678
|
|
|
707
|
-
export {
|
|
708
|
-
$DEVCOMP,
|
|
709
|
-
$PROXY,
|
|
710
|
-
$TRACK,
|
|
711
|
-
DEV,
|
|
712
|
-
ErrorBoundary,
|
|
713
|
-
For,
|
|
714
|
-
Index,
|
|
715
|
-
Match,
|
|
716
|
-
Show,
|
|
717
|
-
Suspense,
|
|
718
|
-
SuspenseList,
|
|
719
|
-
Switch,
|
|
720
|
-
batch,
|
|
721
|
-
catchError,
|
|
722
|
-
children,
|
|
723
|
-
createComponent,
|
|
724
|
-
createComputed,
|
|
725
|
-
createContext,
|
|
726
|
-
createDeferred,
|
|
727
|
-
createEffect,
|
|
728
|
-
createMemo,
|
|
729
|
-
createReaction,
|
|
730
|
-
createRenderEffect,
|
|
731
|
-
createResource,
|
|
732
|
-
createRoot,
|
|
733
|
-
createSelector,
|
|
734
|
-
createSignal,
|
|
735
|
-
createUniqueId,
|
|
736
|
-
enableExternalSource,
|
|
737
|
-
enableHydration,
|
|
738
|
-
enableScheduling,
|
|
739
|
-
equalFn,
|
|
740
|
-
from,
|
|
741
|
-
getListener,
|
|
742
|
-
getOwner,
|
|
743
|
-
lazy,
|
|
744
|
-
mapArray,
|
|
745
|
-
mergeProps,
|
|
746
|
-
observable,
|
|
747
|
-
on,
|
|
748
|
-
onCleanup,
|
|
749
|
-
onError,
|
|
750
|
-
onMount,
|
|
751
|
-
requestCallback,
|
|
752
|
-
resetErrorBoundaries,
|
|
753
|
-
runWithOwner,
|
|
754
|
-
sharedConfig,
|
|
755
|
-
splitProps,
|
|
756
|
-
startTransition,
|
|
757
|
-
untrack,
|
|
758
|
-
useContext,
|
|
759
|
-
useTransition
|
|
760
|
-
};
|
|
679
|
+
export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, catchError, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -270,7 +270,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
270
270
|
if (sharedConfig.context) {
|
|
271
271
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
272
272
|
let v;
|
|
273
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP =
|
|
273
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
274
274
|
}
|
|
275
275
|
function loadEnd(p, v, error, key) {
|
|
276
276
|
if (pr === p) {
|
|
@@ -336,6 +336,10 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
336
336
|
loadEnd(pr, p, undefined, lookup);
|
|
337
337
|
return p;
|
|
338
338
|
}
|
|
339
|
+
if ("value" in p) {
|
|
340
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
|
|
341
|
+
return p;
|
|
342
|
+
}
|
|
339
343
|
pr = p;
|
|
340
344
|
scheduled = true;
|
|
341
345
|
queueMicrotask(() => scheduled = false);
|