solid-js 1.3.0-beta.3 → 1.3.0-beta.7

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 CHANGED
@@ -149,6 +149,7 @@ const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
149
149
  var Owner = null;
150
150
  let Transition = null;
151
151
  let Scheduler = null;
152
+ let ExternalSourceFactory = null;
152
153
  let Listener = null;
153
154
  let Pending = null;
154
155
  let Updates = null;
@@ -246,10 +247,13 @@ function createResource(source, fetcher, options) {
246
247
  pr = null,
247
248
  initP = null,
248
249
  id = null,
250
+ ctx,
249
251
  loadedUnderTransition = false,
250
252
  dynamic = typeof source === "function";
251
253
  if (sharedConfig.context) {
252
254
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
255
+ ctx = { ...sharedConfig.context
256
+ };
253
257
  if (sharedConfig.load) initP = sharedConfig.load(id);
254
258
  }
255
259
  function loadEnd(p, v, e) {
@@ -267,7 +271,14 @@ function createResource(source, fetcher, options) {
267
271
  }
268
272
  completeLoad(v);
269
273
  }, false);
270
- } else completeLoad(v);
274
+ } else {
275
+ if (p === initP) setHydrateContext(ctx);
276
+ completeLoad(v);
277
+ if (p === initP) {
278
+ initP = null;
279
+ setHydrateContext();
280
+ }
281
+ }
271
282
  }
272
283
  return v;
273
284
  }
@@ -305,8 +316,7 @@ function createResource(source, fetcher, options) {
305
316
  return;
306
317
  }
307
318
  if (Transition && pr) Transition.promises.delete(pr);
308
- const p = initP || untrack(() => fetcher(lookup, s));
309
- initP = null;
319
+ const p = sharedConfig.context && initP || untrack(() => fetcher(lookup, s));
310
320
  if (typeof p !== "object" || !("then" in p)) {
311
321
  loadEnd(pr, p);
312
322
  return;
@@ -554,6 +564,24 @@ let SuspenseContext;
554
564
  function getSuspenseContext() {
555
565
  return SuspenseContext || (SuspenseContext = createContext({}));
556
566
  }
567
+ function enableExternalSource(factory) {
568
+ if (ExternalSourceFactory) {
569
+ const oldFactory = ExternalSourceFactory;
570
+ ExternalSourceFactory = (fn, trigger) => {
571
+ const oldSource = oldFactory(fn, trigger);
572
+ const source = factory(x => oldSource.track(x), trigger);
573
+ return {
574
+ track: x => source.track(x),
575
+ dispose() {
576
+ source.dispose();
577
+ oldSource.dispose();
578
+ }
579
+ };
580
+ };
581
+ } else {
582
+ ExternalSourceFactory = factory;
583
+ }
584
+ }
557
585
  function readSignal() {
558
586
  const runningTransition = Transition && Transition.running;
559
587
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
@@ -682,6 +710,19 @@ function createComputation(fn, init, pure, state = STALE, options) {
682
710
  }
683
711
  c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
684
712
  }
713
+ if (ExternalSourceFactory) {
714
+ const [track, trigger] = createSignal(undefined, {
715
+ equals: false
716
+ });
717
+ const ordinary = ExternalSourceFactory(c.fn, trigger);
718
+ onCleanup(() => ordinary.dispose());
719
+ const triggerInTransition = () => startTransition(trigger, () => inTransition.dispose());
720
+ const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
721
+ c.fn = x => {
722
+ track();
723
+ return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
724
+ };
725
+ }
685
726
  return c;
686
727
  }
687
728
  function runTop(node) {
@@ -1139,13 +1180,19 @@ function indexArray(list, mapFn, options = {}) {
1139
1180
  };
1140
1181
  }
1141
1182
 
1183
+ let hydrationEnabled = false;
1184
+ function enableHydration() {
1185
+ hydrationEnabled = true;
1186
+ }
1142
1187
  function createComponent(Comp, props) {
1143
- if (sharedConfig.context) {
1144
- const c = sharedConfig.context;
1145
- setHydrateContext(nextHydrateContext());
1146
- const r = devComponent(Comp, props) ;
1147
- setHydrateContext(c);
1148
- return r;
1188
+ if (hydrationEnabled) {
1189
+ if (sharedConfig.context) {
1190
+ const c = sharedConfig.context;
1191
+ setHydrateContext(nextHydrateContext());
1192
+ const r = devComponent(Comp, props) ;
1193
+ setHydrateContext(c);
1194
+ return r;
1195
+ }
1149
1196
  }
1150
1197
  return devComponent(Comp, props);
1151
1198
  }
@@ -1234,19 +1281,20 @@ function splitProps(props, ...keys) {
1234
1281
  }
1235
1282
  function lazy(fn) {
1236
1283
  let comp;
1284
+ let p;
1237
1285
  const wrap = props => {
1238
1286
  const ctx = sharedConfig.context;
1239
1287
  if (ctx) {
1240
1288
  ctx.count++;
1241
1289
  const [s, set] = createSignal();
1242
- fn().then(mod => {
1290
+ (p || (p = fn())).then(mod => {
1243
1291
  setHydrateContext(ctx);
1244
1292
  set(() => mod.default);
1245
- setHydrateContext(undefined);
1293
+ setHydrateContext();
1246
1294
  });
1247
1295
  comp = s;
1248
1296
  } else if (!comp) {
1249
- const [s] = createResource(() => fn().then(mod => mod.default));
1297
+ const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default));
1250
1298
  comp = s;
1251
1299
  } else {
1252
1300
  const c = comp();
@@ -1262,7 +1310,7 @@ function lazy(fn) {
1262
1310
  return r;
1263
1311
  }));
1264
1312
  };
1265
- wrap.preload = () => comp || fn().then(mod => comp = () => mod.default);
1313
+ wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1266
1314
  return wrap;
1267
1315
  }
1268
1316
  let counter = 0;
@@ -1473,7 +1521,10 @@ function Suspense(props) {
1473
1521
  if (!visibleFallback) return;
1474
1522
  return createRoot(disposer => {
1475
1523
  dispose = disposer;
1476
- if (sharedConfig.context) sharedConfig.context.count = 0;
1524
+ if (sharedConfig.context) setHydrateContext({
1525
+ id: sharedConfig.context.id + "f",
1526
+ count: 0
1527
+ });
1477
1528
  return props.fallback;
1478
1529
  }, owner);
1479
1530
  });
@@ -1519,6 +1570,8 @@ exports.createRoot = createRoot;
1519
1570
  exports.createSelector = createSelector;
1520
1571
  exports.createSignal = createSignal;
1521
1572
  exports.createUniqueId = createUniqueId;
1573
+ exports.enableExternalSource = enableExternalSource;
1574
+ exports.enableHydration = enableHydration;
1522
1575
  exports.enableScheduling = enableScheduling;
1523
1576
  exports.equalFn = equalFn;
1524
1577
  exports.from = from;
package/dist/dev.js CHANGED
@@ -145,6 +145,7 @@ const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
145
145
  var Owner = null;
146
146
  let Transition = null;
147
147
  let Scheduler = null;
148
+ let ExternalSourceFactory = null;
148
149
  let Listener = null;
149
150
  let Pending = null;
150
151
  let Updates = null;
@@ -242,10 +243,13 @@ function createResource(source, fetcher, options) {
242
243
  pr = null,
243
244
  initP = null,
244
245
  id = null,
246
+ ctx,
245
247
  loadedUnderTransition = false,
246
248
  dynamic = typeof source === "function";
247
249
  if (sharedConfig.context) {
248
250
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
251
+ ctx = { ...sharedConfig.context
252
+ };
249
253
  if (sharedConfig.load) initP = sharedConfig.load(id);
250
254
  }
251
255
  function loadEnd(p, v, e) {
@@ -263,7 +267,14 @@ function createResource(source, fetcher, options) {
263
267
  }
264
268
  completeLoad(v);
265
269
  }, false);
266
- } else completeLoad(v);
270
+ } else {
271
+ if (p === initP) setHydrateContext(ctx);
272
+ completeLoad(v);
273
+ if (p === initP) {
274
+ initP = null;
275
+ setHydrateContext();
276
+ }
277
+ }
267
278
  }
268
279
  return v;
269
280
  }
@@ -301,8 +312,7 @@ function createResource(source, fetcher, options) {
301
312
  return;
302
313
  }
303
314
  if (Transition && pr) Transition.promises.delete(pr);
304
- const p = initP || untrack(() => fetcher(lookup, s));
305
- initP = null;
315
+ const p = sharedConfig.context && initP || untrack(() => fetcher(lookup, s));
306
316
  if (typeof p !== "object" || !("then" in p)) {
307
317
  loadEnd(pr, p);
308
318
  return;
@@ -550,6 +560,24 @@ let SuspenseContext;
550
560
  function getSuspenseContext() {
551
561
  return SuspenseContext || (SuspenseContext = createContext({}));
552
562
  }
563
+ function enableExternalSource(factory) {
564
+ if (ExternalSourceFactory) {
565
+ const oldFactory = ExternalSourceFactory;
566
+ ExternalSourceFactory = (fn, trigger) => {
567
+ const oldSource = oldFactory(fn, trigger);
568
+ const source = factory(x => oldSource.track(x), trigger);
569
+ return {
570
+ track: x => source.track(x),
571
+ dispose() {
572
+ source.dispose();
573
+ oldSource.dispose();
574
+ }
575
+ };
576
+ };
577
+ } else {
578
+ ExternalSourceFactory = factory;
579
+ }
580
+ }
553
581
  function readSignal() {
554
582
  const runningTransition = Transition && Transition.running;
555
583
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
@@ -678,6 +706,19 @@ function createComputation(fn, init, pure, state = STALE, options) {
678
706
  }
679
707
  c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
680
708
  }
709
+ if (ExternalSourceFactory) {
710
+ const [track, trigger] = createSignal(undefined, {
711
+ equals: false
712
+ });
713
+ const ordinary = ExternalSourceFactory(c.fn, trigger);
714
+ onCleanup(() => ordinary.dispose());
715
+ const triggerInTransition = () => startTransition(trigger, () => inTransition.dispose());
716
+ const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
717
+ c.fn = x => {
718
+ track();
719
+ return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
720
+ };
721
+ }
681
722
  return c;
682
723
  }
683
724
  function runTop(node) {
@@ -1135,13 +1176,19 @@ function indexArray(list, mapFn, options = {}) {
1135
1176
  };
1136
1177
  }
1137
1178
 
1179
+ let hydrationEnabled = false;
1180
+ function enableHydration() {
1181
+ hydrationEnabled = true;
1182
+ }
1138
1183
  function createComponent(Comp, props) {
1139
- if (sharedConfig.context) {
1140
- const c = sharedConfig.context;
1141
- setHydrateContext(nextHydrateContext());
1142
- const r = devComponent(Comp, props) ;
1143
- setHydrateContext(c);
1144
- return r;
1184
+ if (hydrationEnabled) {
1185
+ if (sharedConfig.context) {
1186
+ const c = sharedConfig.context;
1187
+ setHydrateContext(nextHydrateContext());
1188
+ const r = devComponent(Comp, props) ;
1189
+ setHydrateContext(c);
1190
+ return r;
1191
+ }
1145
1192
  }
1146
1193
  return devComponent(Comp, props);
1147
1194
  }
@@ -1230,19 +1277,20 @@ function splitProps(props, ...keys) {
1230
1277
  }
1231
1278
  function lazy(fn) {
1232
1279
  let comp;
1280
+ let p;
1233
1281
  const wrap = props => {
1234
1282
  const ctx = sharedConfig.context;
1235
1283
  if (ctx) {
1236
1284
  ctx.count++;
1237
1285
  const [s, set] = createSignal();
1238
- fn().then(mod => {
1286
+ (p || (p = fn())).then(mod => {
1239
1287
  setHydrateContext(ctx);
1240
1288
  set(() => mod.default);
1241
- setHydrateContext(undefined);
1289
+ setHydrateContext();
1242
1290
  });
1243
1291
  comp = s;
1244
1292
  } else if (!comp) {
1245
- const [s] = createResource(() => fn().then(mod => mod.default));
1293
+ const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default));
1246
1294
  comp = s;
1247
1295
  } else {
1248
1296
  const c = comp();
@@ -1258,7 +1306,7 @@ function lazy(fn) {
1258
1306
  return r;
1259
1307
  }));
1260
1308
  };
1261
- wrap.preload = () => comp || fn().then(mod => comp = () => mod.default);
1309
+ wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1262
1310
  return wrap;
1263
1311
  }
1264
1312
  let counter = 0;
@@ -1469,7 +1517,10 @@ function Suspense(props) {
1469
1517
  if (!visibleFallback) return;
1470
1518
  return createRoot(disposer => {
1471
1519
  dispose = disposer;
1472
- if (sharedConfig.context) sharedConfig.context.count = 0;
1520
+ if (sharedConfig.context) setHydrateContext({
1521
+ id: sharedConfig.context.id + "f",
1522
+ count: 0
1523
+ });
1473
1524
  return props.fallback;
1474
1525
  }, owner);
1475
1526
  });
@@ -1491,4 +1542,4 @@ if (globalThis) {
1491
1542
  if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1492
1543
  }
1493
1544
 
1494
- export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
1545
+ export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
package/dist/server.cjs CHANGED
@@ -208,6 +208,7 @@ function from(producer) {
208
208
  }
209
209
  return s;
210
210
  }
211
+ function enableExternalSource(factory) {}
211
212
 
212
213
  function resolveSSRNode(node) {
213
214
  const t = typeof node;
@@ -350,7 +351,7 @@ function createResource(fn, fetcher, options = {}) {
350
351
  if (error) throw error;
351
352
  if (resourceContext && p) resourceContext.push(p);
352
353
  const resolved = sharedConfig.context.async && sharedConfig.context.resources[id].data;
353
- if (!resolved) {
354
+ if (!resolved && read.loading) {
354
355
  const ctx = useContext(SuspenseContext);
355
356
  if (ctx) {
356
357
  ctx.resources.set(id, read);
@@ -362,7 +363,7 @@ function createResource(fn, fetcher, options = {}) {
362
363
  read.loading = false;
363
364
  function load() {
364
365
  const ctx = sharedConfig.context;
365
- if (!ctx.async) return read.loading = true;
366
+ if (!ctx.async) return read.loading = !!(typeof fn === "function" ? fn() : fn);
366
367
  if (ctx.resources && id in ctx.resources && ctx.resources[id].data) {
367
368
  value = ctx.resources[id].data;
368
369
  return;
@@ -425,7 +426,7 @@ function lazy(fn) {
425
426
  });
426
427
  return "";
427
428
  };
428
- wrap.preload = () => {};
429
+ wrap.preload = () => p;
429
430
  return wrap;
430
431
  }
431
432
  function suspenseComplete(c) {
@@ -501,9 +502,10 @@ function Suspense(props) {
501
502
  };
502
503
  }
503
504
  setHydrateContext({ ...ctx,
504
- count: 0
505
+ count: 0,
506
+ id: ctx.id + "0.f"
505
507
  });
506
- return createComponent(() => props.fallback, {});
508
+ return props.fallback;
507
509
  }
508
510
 
509
511
  exports.$PROXY = $PROXY;
@@ -530,6 +532,7 @@ exports.createRoot = createRoot;
530
532
  exports.createSelector = createSelector;
531
533
  exports.createSignal = createSignal;
532
534
  exports.createUniqueId = createUniqueId;
535
+ exports.enableExternalSource = enableExternalSource;
533
536
  exports.enableScheduling = enableScheduling;
534
537
  exports.equalFn = equalFn;
535
538
  exports.from = from;
package/dist/server.js CHANGED
@@ -204,6 +204,7 @@ function from(producer) {
204
204
  }
205
205
  return s;
206
206
  }
207
+ function enableExternalSource(factory) {}
207
208
 
208
209
  function resolveSSRNode(node) {
209
210
  const t = typeof node;
@@ -346,7 +347,7 @@ function createResource(fn, fetcher, options = {}) {
346
347
  if (error) throw error;
347
348
  if (resourceContext && p) resourceContext.push(p);
348
349
  const resolved = sharedConfig.context.async && sharedConfig.context.resources[id].data;
349
- if (!resolved) {
350
+ if (!resolved && read.loading) {
350
351
  const ctx = useContext(SuspenseContext);
351
352
  if (ctx) {
352
353
  ctx.resources.set(id, read);
@@ -358,7 +359,7 @@ function createResource(fn, fetcher, options = {}) {
358
359
  read.loading = false;
359
360
  function load() {
360
361
  const ctx = sharedConfig.context;
361
- if (!ctx.async) return read.loading = true;
362
+ if (!ctx.async) return read.loading = !!(typeof fn === "function" ? fn() : fn);
362
363
  if (ctx.resources && id in ctx.resources && ctx.resources[id].data) {
363
364
  value = ctx.resources[id].data;
364
365
  return;
@@ -421,7 +422,7 @@ function lazy(fn) {
421
422
  });
422
423
  return "";
423
424
  };
424
- wrap.preload = () => {};
425
+ wrap.preload = () => p;
425
426
  return wrap;
426
427
  }
427
428
  function suspenseComplete(c) {
@@ -497,9 +498,10 @@ function Suspense(props) {
497
498
  };
498
499
  }
499
500
  setHydrateContext({ ...ctx,
500
- count: 0
501
+ count: 0,
502
+ id: ctx.id + "0.f"
501
503
  });
502
- return createComponent(() => props.fallback, {});
504
+ return props.fallback;
503
505
  }
504
506
 
505
- export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
507
+ export { $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
package/dist/solid.cjs CHANGED
@@ -149,6 +149,7 @@ const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
149
149
  var Owner = null;
150
150
  let Transition = null;
151
151
  let Scheduler = null;
152
+ let ExternalSourceFactory = null;
152
153
  let Listener = null;
153
154
  let Pending = null;
154
155
  let Updates = null;
@@ -243,10 +244,13 @@ function createResource(source, fetcher, options) {
243
244
  pr = null,
244
245
  initP = null,
245
246
  id = null,
247
+ ctx,
246
248
  loadedUnderTransition = false,
247
249
  dynamic = typeof source === "function";
248
250
  if (sharedConfig.context) {
249
251
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
252
+ ctx = { ...sharedConfig.context
253
+ };
250
254
  if (sharedConfig.load) initP = sharedConfig.load(id);
251
255
  }
252
256
  function loadEnd(p, v, e) {
@@ -264,7 +268,14 @@ function createResource(source, fetcher, options) {
264
268
  }
265
269
  completeLoad(v);
266
270
  }, false);
267
- } else completeLoad(v);
271
+ } else {
272
+ if (p === initP) setHydrateContext(ctx);
273
+ completeLoad(v);
274
+ if (p === initP) {
275
+ initP = null;
276
+ setHydrateContext();
277
+ }
278
+ }
268
279
  }
269
280
  return v;
270
281
  }
@@ -302,8 +313,7 @@ function createResource(source, fetcher, options) {
302
313
  return;
303
314
  }
304
315
  if (Transition && pr) Transition.promises.delete(pr);
305
- const p = initP || untrack(() => fetcher(lookup, s));
306
- initP = null;
316
+ const p = sharedConfig.context && initP || untrack(() => fetcher(lookup, s));
307
317
  if (typeof p !== "object" || !("then" in p)) {
308
318
  loadEnd(pr, p);
309
319
  return;
@@ -503,6 +513,24 @@ let SuspenseContext;
503
513
  function getSuspenseContext() {
504
514
  return SuspenseContext || (SuspenseContext = createContext({}));
505
515
  }
516
+ function enableExternalSource(factory) {
517
+ if (ExternalSourceFactory) {
518
+ const oldFactory = ExternalSourceFactory;
519
+ ExternalSourceFactory = (fn, trigger) => {
520
+ const oldSource = oldFactory(fn, trigger);
521
+ const source = factory(x => oldSource.track(x), trigger);
522
+ return {
523
+ track: x => source.track(x),
524
+ dispose() {
525
+ source.dispose();
526
+ oldSource.dispose();
527
+ }
528
+ };
529
+ };
530
+ } else {
531
+ ExternalSourceFactory = factory;
532
+ }
533
+ }
506
534
  function readSignal() {
507
535
  const runningTransition = Transition && Transition.running;
508
536
  if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) {
@@ -630,6 +658,19 @@ function createComputation(fn, init, pure, state = STALE, options) {
630
658
  if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
631
659
  }
632
660
  }
661
+ if (ExternalSourceFactory) {
662
+ const [track, trigger] = createSignal(undefined, {
663
+ equals: false
664
+ });
665
+ const ordinary = ExternalSourceFactory(c.fn, trigger);
666
+ onCleanup(() => ordinary.dispose());
667
+ const triggerInTransition = () => startTransition(trigger, () => inTransition.dispose());
668
+ const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
669
+ c.fn = x => {
670
+ track();
671
+ return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
672
+ };
673
+ }
633
674
  return c;
634
675
  }
635
676
  function runTop(node) {
@@ -1063,13 +1104,19 @@ function indexArray(list, mapFn, options = {}) {
1063
1104
  };
1064
1105
  }
1065
1106
 
1107
+ let hydrationEnabled = false;
1108
+ function enableHydration() {
1109
+ hydrationEnabled = true;
1110
+ }
1066
1111
  function createComponent(Comp, props) {
1067
- if (sharedConfig.context) {
1068
- const c = sharedConfig.context;
1069
- setHydrateContext(nextHydrateContext());
1070
- const r = untrack(() => Comp(props));
1071
- setHydrateContext(c);
1072
- return r;
1112
+ if (hydrationEnabled) {
1113
+ if (sharedConfig.context) {
1114
+ const c = sharedConfig.context;
1115
+ setHydrateContext(nextHydrateContext());
1116
+ const r = untrack(() => Comp(props));
1117
+ setHydrateContext(c);
1118
+ return r;
1119
+ }
1073
1120
  }
1074
1121
  return untrack(() => Comp(props));
1075
1122
  }
@@ -1158,19 +1205,20 @@ function splitProps(props, ...keys) {
1158
1205
  }
1159
1206
  function lazy(fn) {
1160
1207
  let comp;
1208
+ let p;
1161
1209
  const wrap = props => {
1162
1210
  const ctx = sharedConfig.context;
1163
1211
  if (ctx) {
1164
1212
  ctx.count++;
1165
1213
  const [s, set] = createSignal();
1166
- fn().then(mod => {
1214
+ (p || (p = fn())).then(mod => {
1167
1215
  setHydrateContext(ctx);
1168
1216
  set(() => mod.default);
1169
- setHydrateContext(undefined);
1217
+ setHydrateContext();
1170
1218
  });
1171
1219
  comp = s;
1172
1220
  } else if (!comp) {
1173
- const [s] = createResource(() => fn().then(mod => mod.default));
1221
+ const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default));
1174
1222
  comp = s;
1175
1223
  } else {
1176
1224
  const c = comp();
@@ -1186,7 +1234,7 @@ function lazy(fn) {
1186
1234
  return r;
1187
1235
  }));
1188
1236
  };
1189
- wrap.preload = () => comp || fn().then(mod => comp = () => mod.default);
1237
+ wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1190
1238
  return wrap;
1191
1239
  }
1192
1240
  let counter = 0;
@@ -1397,7 +1445,10 @@ function Suspense(props) {
1397
1445
  if (!visibleFallback) return;
1398
1446
  return createRoot(disposer => {
1399
1447
  dispose = disposer;
1400
- if (sharedConfig.context) sharedConfig.context.count = 0;
1448
+ if (sharedConfig.context) setHydrateContext({
1449
+ id: sharedConfig.context.id + "f",
1450
+ count: 0
1451
+ });
1401
1452
  return props.fallback;
1402
1453
  }, owner);
1403
1454
  });
@@ -1433,6 +1484,8 @@ exports.createRoot = createRoot;
1433
1484
  exports.createSelector = createSelector;
1434
1485
  exports.createSignal = createSignal;
1435
1486
  exports.createUniqueId = createUniqueId;
1487
+ exports.enableExternalSource = enableExternalSource;
1488
+ exports.enableHydration = enableHydration;
1436
1489
  exports.enableScheduling = enableScheduling;
1437
1490
  exports.equalFn = equalFn;
1438
1491
  exports.from = from;