solid-js 1.6.8 → 1.6.9

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.js CHANGED
@@ -1,18 +1,18 @@
1
1
  let taskIdCounter = 1,
2
- isCallbackScheduled = false,
3
- isPerformingWork = false,
4
- taskQueue = [],
5
- currentTask = null,
6
- shouldYieldToHost = null,
7
- yieldInterval = 5,
8
- deadline = 0,
9
- maxYieldInterval = 300,
10
- scheduleCallback = null,
11
- scheduledCallback = null;
2
+ isCallbackScheduled = false,
3
+ isPerformingWork = false,
4
+ taskQueue = [],
5
+ currentTask = null,
6
+ shouldYieldToHost = null,
7
+ yieldInterval = 5,
8
+ deadline = 0,
9
+ maxYieldInterval = 300,
10
+ scheduleCallback = null,
11
+ scheduledCallback = null;
12
12
  const maxSigned31BitInt = 1073741823;
13
13
  function setupScheduler() {
14
14
  const channel = new MessageChannel(),
15
- port = channel.port2;
15
+ port = channel.port2;
16
16
  scheduleCallback = () => port.postMessage(null);
17
17
  channel.port1.onmessage = () => {
18
18
  if (scheduledCallback !== null) {
@@ -63,7 +63,7 @@ function enqueue(taskQueue, task) {
63
63
  function requestCallback(fn, options) {
64
64
  if (!scheduleCallback) setupScheduler();
65
65
  let startTime = performance.now(),
66
- timeout = maxSigned31BitInt;
66
+ timeout = maxSigned31BitInt;
67
67
  if (options && options.timeout) timeout = options.timeout;
68
68
  const newTask = {
69
69
  id: taskIdCounter++,
@@ -119,7 +119,8 @@ function setHydrateContext(context) {
119
119
  sharedConfig.context = context;
120
120
  }
121
121
  function nextHydrateContext() {
122
- return { ...sharedConfig.context,
122
+ return {
123
+ ...sharedConfig.context,
123
124
  id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
124
125
  count: 0
125
126
  };
@@ -155,22 +156,22 @@ let rootCount = 0;
155
156
  const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
156
157
  function createRoot(fn, detachedOwner) {
157
158
  const listener = Listener,
158
- owner = Owner,
159
- unowned = fn.length === 0,
160
- root = unowned ? {
161
- owned: null,
162
- cleanups: null,
163
- context: null,
164
- owner: null
165
- } : {
166
- owned: null,
167
- cleanups: null,
168
- context: null,
169
- owner: detachedOwner || owner
170
- },
171
- updateFn = unowned ? () => fn(() => {
172
- throw new Error("Dispose method must be an explicit argument to createRoot function");
173
- }) : () => fn(() => untrack(() => cleanNode(root)));
159
+ owner = Owner,
160
+ unowned = fn.length === 0,
161
+ root = unowned ? {
162
+ owned: null,
163
+ cleanups: null,
164
+ context: null,
165
+ owner: null
166
+ } : {
167
+ owned: null,
168
+ cleanups: null,
169
+ context: null,
170
+ owner: detachedOwner || owner
171
+ },
172
+ updateFn = unowned ? () => fn(() => {
173
+ throw new Error("Dispose method must be an explicit argument to createRoot function");
174
+ }) : () => fn(() => untrack(() => cleanNode(root)));
174
175
  {
175
176
  if (owner) root.name = `${owner.name}-r${rootCount++}`;
176
177
  globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
@@ -212,7 +213,7 @@ function createRenderEffect(fn, value, options) {
212
213
  function createEffect(fn, value, options) {
213
214
  runEffects = runUserEffects;
214
215
  const c = createComputation(fn, value, false, STALE, options ),
215
- s = SuspenseContext && lookup(Owner, SuspenseContext.id);
216
+ s = SuspenseContext && lookup(Owner, SuspenseContext.id);
216
217
  if (s) c.suspense = s;
217
218
  c.user = true;
218
219
  Effects ? Effects.push(c) : updateComputation(c);
@@ -220,10 +221,10 @@ function createEffect(fn, value, options) {
220
221
  function createReaction(onInvalidate, options) {
221
222
  let fn;
222
223
  const c = createComputation(() => {
223
- fn ? fn() : untrack(onInvalidate);
224
- fn = undefined;
225
- }, undefined, false, 0, options ),
226
- s = SuspenseContext && lookup(Owner, SuspenseContext.id);
224
+ fn ? fn() : untrack(onInvalidate);
225
+ fn = undefined;
226
+ }, undefined, false, 0, options ),
227
+ s = SuspenseContext && lookup(Owner, SuspenseContext.id);
227
228
  if (s) c.suspense = s;
228
229
  c.user = true;
229
230
  return tracking => {
@@ -257,19 +258,19 @@ function createResource(pSource, pFetcher, pOptions) {
257
258
  options = pOptions || {};
258
259
  }
259
260
  let pr = null,
260
- initP = NO_INIT,
261
- id = null,
262
- loadedUnderTransition = false,
263
- scheduled = false,
264
- resolved = ("initialValue" in options),
265
- dynamic = typeof source === "function" && createMemo(source);
261
+ initP = NO_INIT,
262
+ id = null,
263
+ loadedUnderTransition = false,
264
+ scheduled = false,
265
+ resolved = ("initialValue" in options),
266
+ dynamic = typeof source === "function" && createMemo(source);
266
267
  const contexts = new Set(),
267
- [value, setValue] = (options.storage || createSignal)(options.initialValue),
268
- [error, setError] = createSignal(undefined),
269
- [track, trigger] = createSignal(undefined, {
270
- equals: false
271
- }),
272
- [state, setState] = createSignal(resolved ? "ready" : "unresolved");
268
+ [value, setValue] = (options.storage || createSignal)(options.initialValue),
269
+ [error, setError] = createSignal(undefined),
270
+ [track, trigger] = createSignal(undefined, {
271
+ equals: false
272
+ }),
273
+ [state, setState] = createSignal(resolved ? "ready" : "unresolved");
273
274
  if (sharedConfig.context) {
274
275
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
275
276
  let v;
@@ -305,8 +306,8 @@ function createResource(pSource, pFetcher, pOptions) {
305
306
  }
306
307
  function read() {
307
308
  const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
308
- v = value(),
309
- err = error();
309
+ v = value(),
310
+ err = error();
310
311
  if (err && !pr) throw err;
311
312
  if (Listener && !Listener.user && c) {
312
313
  createComputed(() => {
@@ -378,7 +379,7 @@ function createResource(pSource, pFetcher, pOptions) {
378
379
  }
379
380
  function createDeferred(source, options) {
380
381
  let t,
381
- timeout = options ? options.timeoutMs : undefined;
382
+ timeout = options ? options.timeoutMs : undefined;
382
383
  const node = createComputation(() => {
383
384
  if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
384
385
  timeout
@@ -521,11 +522,10 @@ function devComponent(Comp, props) {
521
522
  [$DEVCOMP]: true
522
523
  });
523
524
  return Comp(props);
524
- }), undefined, true);
525
+ }), undefined, true, 0);
525
526
  c.props = props;
526
527
  c.observers = null;
527
528
  c.observerSlots = null;
528
- c.state = 0;
529
529
  c.componentName = Comp.name;
530
530
  updateComputation(c);
531
531
  return c.tValue !== undefined ? c.tValue : c.value;
@@ -558,13 +558,15 @@ function registerGraph(name, value) {
558
558
  Owner.sourceMap || (Owner.sourceMap = {});
559
559
  while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
560
560
  Owner.sourceMap[tryName] = value;
561
+ value.graph = Owner;
561
562
  }
562
563
  return tryName;
563
564
  }
564
565
  function serializeGraph(owner) {
565
566
  owner || (owner = Owner);
566
567
  if (!owner) return {};
567
- return { ...serializeValues(owner.sourceMap),
568
+ return {
569
+ ...serializeValues(owner.sourceMap),
568
570
  ...(owner.owned ? serializeChildren(owner) : {})
569
571
  };
570
572
  }
@@ -680,8 +682,8 @@ function updateComputation(node) {
680
682
  if (!node.fn) return;
681
683
  cleanNode(node);
682
684
  const owner = Owner,
683
- listener = Listener,
684
- time = ExecCount;
685
+ listener = Listener,
686
+ time = ExecCount;
685
687
  Listener = Owner = node;
686
688
  runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
687
689
  if (Transition && !Transition.running && Transition.sources.has(node)) {
@@ -702,7 +704,17 @@ function runComputation(node, value, time) {
702
704
  try {
703
705
  nextValue = node.fn(value);
704
706
  } catch (err) {
705
- if (node.pure) Transition && Transition.running ? node.tState = STALE : node.state = STALE;
707
+ if (node.pure) {
708
+ if (Transition && Transition.running) {
709
+ node.tState = STALE;
710
+ node.tOwned && node.tOwned.forEach(cleanNode);
711
+ node.tOwned = undefined;
712
+ } else {
713
+ node.state = STALE;
714
+ node.owned && node.owned.forEach(cleanNode);
715
+ node.owned = null;
716
+ }
717
+ }
706
718
  handleError(err);
707
719
  }
708
720
  if (!node.updatedAt || node.updatedAt <= time) {
@@ -770,7 +782,7 @@ function runTop(node) {
770
782
  node = ancestors[i];
771
783
  if (runningTransition) {
772
784
  let top = node,
773
- prev = ancestors[i + 1];
785
+ prev = ancestors[i + 1];
774
786
  while ((top = top.owner) && top !== prev) {
775
787
  if (Transition.disposed.has(top)) return;
776
788
  }
@@ -867,7 +879,7 @@ function scheduleQueue(queue) {
867
879
  }
868
880
  function runUserEffects(queue) {
869
881
  let i,
870
- userLength = 0;
882
+ userLength = 0;
871
883
  for (i = 0; i < queue.length; i++) {
872
884
  const e = queue[i];
873
885
  if (!e.user) runTop(e);else queue[userLength++] = e;
@@ -903,11 +915,11 @@ function cleanNode(node) {
903
915
  if (node.sources) {
904
916
  while (node.sources.length) {
905
917
  const source = node.sources.pop(),
906
- index = node.sourceSlots.pop(),
907
- obs = source.observers;
918
+ index = node.sourceSlots.pop(),
919
+ obs = source.observers;
908
920
  if (obs && obs.length) {
909
921
  const n = obs.pop(),
910
- s = source.observerSlots.pop();
922
+ s = source.observerSlots.pop();
911
923
  if (index < obs.length) {
912
924
  n.sourceSlots[s] = index;
913
925
  obs[index] = n;
@@ -997,7 +1009,8 @@ function serializeChildren(root) {
997
1009
  const result = {};
998
1010
  for (let i = 0, len = root.owned.length; i < len; i++) {
999
1011
  const node = root.owned[i];
1000
- result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = { ...serializeValues(node.sourceMap),
1012
+ result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
1013
+ ...serializeValues(node.sourceMap),
1001
1014
  ...(node.owned ? serializeChildren(node) : {})
1002
1015
  };
1003
1016
  }
@@ -1055,27 +1068,27 @@ function dispose(d) {
1055
1068
  }
1056
1069
  function mapArray(list, mapFn, options = {}) {
1057
1070
  let items = [],
1058
- mapped = [],
1059
- disposers = [],
1060
- len = 0,
1061
- indexes = mapFn.length > 1 ? [] : null;
1071
+ mapped = [],
1072
+ disposers = [],
1073
+ len = 0,
1074
+ indexes = mapFn.length > 1 ? [] : null;
1062
1075
  onCleanup(() => dispose(disposers));
1063
1076
  return () => {
1064
1077
  let newItems = list() || [],
1065
- i,
1066
- j;
1078
+ i,
1079
+ j;
1067
1080
  newItems[$TRACK];
1068
1081
  return untrack(() => {
1069
1082
  let newLen = newItems.length,
1070
- newIndices,
1071
- newIndicesNext,
1072
- temp,
1073
- tempdisposers,
1074
- tempIndexes,
1075
- start,
1076
- end,
1077
- newEnd,
1078
- item;
1083
+ newIndices,
1084
+ newIndicesNext,
1085
+ temp,
1086
+ tempdisposers,
1087
+ tempIndexes,
1088
+ start,
1089
+ end,
1090
+ newEnd,
1091
+ item;
1079
1092
  if (newLen === 0) {
1080
1093
  if (len !== 0) {
1081
1094
  dispose(disposers);
@@ -1160,11 +1173,11 @@ function mapArray(list, mapFn, options = {}) {
1160
1173
  }
1161
1174
  function indexArray(list, mapFn, options = {}) {
1162
1175
  let items = [],
1163
- mapped = [],
1164
- disposers = [],
1165
- signals = [],
1166
- len = 0,
1167
- i;
1176
+ mapped = [],
1177
+ disposers = [],
1178
+ signals = [],
1179
+ len = 0,
1180
+ i;
1168
1181
  onCleanup(() => dispose(disposers));
1169
1182
  return () => {
1170
1183
  const newItems = list() || [];
@@ -1446,21 +1459,21 @@ function Switch(props) {
1446
1459
  let keyed = false;
1447
1460
  const equals = (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1448
1461
  const conditions = children(() => props.children),
1449
- evalConditions = createMemo(() => {
1450
- let conds = conditions();
1451
- if (!Array.isArray(conds)) conds = [conds];
1452
- for (let i = 0; i < conds.length; i++) {
1453
- const c = conds[i].when;
1454
- if (c) {
1455
- keyed = !!conds[i].keyed;
1456
- return [i, c, conds[i]];
1462
+ evalConditions = createMemo(() => {
1463
+ let conds = conditions();
1464
+ if (!Array.isArray(conds)) conds = [conds];
1465
+ for (let i = 0; i < conds.length; i++) {
1466
+ const c = conds[i].when;
1467
+ if (c) {
1468
+ keyed = !!conds[i].keyed;
1469
+ return [i, c, conds[i]];
1470
+ }
1457
1471
  }
1458
- }
1459
- return [-1];
1460
- }, undefined, {
1461
- equals,
1462
- name: "eval conditions"
1463
- } );
1472
+ return [-1];
1473
+ }, undefined, {
1474
+ equals,
1475
+ name: "eval conditions"
1476
+ } );
1464
1477
  return createMemo(() => {
1465
1478
  const [index, when, cond] = evalConditions();
1466
1479
  if (index < 0) return props.fallback;
@@ -1509,9 +1522,9 @@ const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFa
1509
1522
  const SuspenseListContext = createContext();
1510
1523
  function SuspenseList(props) {
1511
1524
  let [wrapper, setWrapper] = createSignal(() => ({
1512
- inFallback: false
1513
- })),
1514
- show;
1525
+ inFallback: false
1526
+ })),
1527
+ show;
1515
1528
  const listContext = useContext(SuspenseListContext);
1516
1529
  const [registry, setRegistry] = createSignal([]);
1517
1530
  if (listContext) {
@@ -1519,13 +1532,13 @@ function SuspenseList(props) {
1519
1532
  }
1520
1533
  const resolved = createMemo(prev => {
1521
1534
  const reveal = props.revealOrder,
1522
- tail = props.tail,
1523
- {
1524
- showContent = true,
1525
- showFallback = true
1526
- } = show ? show() : {},
1527
- reg = registry(),
1528
- reverse = reveal === "backwards";
1535
+ tail = props.tail,
1536
+ {
1537
+ showContent = true,
1538
+ showFallback = true
1539
+ } = show ? show() : {},
1540
+ reg = registry(),
1541
+ reverse = reveal === "backwards";
1529
1542
  if (reveal === "together") {
1530
1543
  const all = reg.every(inFallback => !inFallback());
1531
1544
  const res = reg.map(() => ({
@@ -1540,7 +1553,7 @@ function SuspenseList(props) {
1540
1553
  const res = [];
1541
1554
  for (let i = 0, len = reg.length; i < len; i++) {
1542
1555
  const n = reverse ? len - i - 1 : i,
1543
- s = reg[n]();
1556
+ s = reg[n]();
1544
1557
  if (!stop && !s) {
1545
1558
  res[n] = {
1546
1559
  showContent,
@@ -1583,25 +1596,25 @@ function SuspenseList(props) {
1583
1596
  }
1584
1597
  function Suspense(props) {
1585
1598
  let counter = 0,
1586
- show,
1587
- ctx,
1588
- p,
1589
- flicker,
1590
- error;
1599
+ show,
1600
+ ctx,
1601
+ p,
1602
+ flicker,
1603
+ error;
1591
1604
  const [inFallback, setFallback] = createSignal(false),
1592
- SuspenseContext = getSuspenseContext(),
1593
- store = {
1594
- increment: () => {
1595
- if (++counter === 1) setFallback(true);
1596
- },
1597
- decrement: () => {
1598
- if (--counter === 0) setFallback(false);
1605
+ SuspenseContext = getSuspenseContext(),
1606
+ store = {
1607
+ increment: () => {
1608
+ if (++counter === 1) setFallback(true);
1609
+ },
1610
+ decrement: () => {
1611
+ if (--counter === 0) setFallback(false);
1612
+ },
1613
+ inFallback,
1614
+ effects: [],
1615
+ resolved: false
1599
1616
  },
1600
- inFallback,
1601
- effects: [],
1602
- resolved: false
1603
- },
1604
- owner = getOwner();
1617
+ owner = getOwner();
1605
1618
  if (sharedConfig.context && sharedConfig.load) {
1606
1619
  const key = sharedConfig.context.id + sharedConfig.context.count;
1607
1620
  let ref = sharedConfig.load(key);
@@ -1641,10 +1654,10 @@ function Suspense(props) {
1641
1654
  const rendered = createMemo(() => props.children);
1642
1655
  return createMemo(prev => {
1643
1656
  const inFallback = store.inFallback(),
1644
- {
1645
- showContent = true,
1646
- showFallback = true
1647
- } = show ? show() : {};
1657
+ {
1658
+ showContent = true,
1659
+ showFallback = true
1660
+ } = show ? show() : {};
1648
1661
  if ((!inFallback || p && p !== "$$f") && showContent) {
1649
1662
  store.resolved = true;
1650
1663
  dispose && dispose();
package/dist/server.cjs CHANGED
@@ -25,10 +25,10 @@ let Owner = null;
25
25
  function createRoot(fn, detachedOwner) {
26
26
  detachedOwner && (Owner = detachedOwner);
27
27
  const owner = Owner,
28
- root = fn.length === 0 ? UNOWNED : {
29
- context: null,
30
- owner
31
- };
28
+ root = fn.length === 0 ? UNOWNED : {
29
+ context: null,
30
+ owner
31
+ };
32
32
  Owner = root;
33
33
  let result;
34
34
  try {
@@ -264,7 +264,8 @@ function setHydrateContext(context) {
264
264
  sharedConfig.context = context;
265
265
  }
266
266
  function nextHydrateContext() {
267
- return sharedConfig.context ? { ...sharedConfig.context,
267
+ return sharedConfig.context ? {
268
+ ...sharedConfig.context,
268
269
  id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
269
270
  count: 0
270
271
  } : undefined;
@@ -311,23 +312,23 @@ function mergeProps(...sources) {
311
312
  }
312
313
  function splitProps(props, ...keys) {
313
314
  const descriptors = Object.getOwnPropertyDescriptors(props),
314
- split = k => {
315
- const clone = {};
316
- for (let i = 0; i < k.length; i++) {
317
- const key = k[i];
318
- if (descriptors[key]) {
319
- Object.defineProperty(clone, key, descriptors[key]);
320
- delete descriptors[key];
315
+ split = k => {
316
+ const clone = {};
317
+ for (let i = 0; i < k.length; i++) {
318
+ const key = k[i];
319
+ if (descriptors[key]) {
320
+ Object.defineProperty(clone, key, descriptors[key]);
321
+ delete descriptors[key];
322
+ }
321
323
  }
322
- }
323
- return clone;
324
- };
324
+ return clone;
325
+ };
325
326
  return keys.map(split).concat(split(Object.keys(descriptors)));
326
327
  }
327
328
  function simpleMap(props, wrap) {
328
329
  const list = props.each || [],
329
- len = list.length,
330
- fn = props.children;
330
+ len = list.length,
331
+ fn = props.children;
331
332
  if (len) {
332
333
  let mapped = Array(len);
333
334
  for (let i = 0; i < len; i++) mapped[i] = wrap(fn, list[i], i);
@@ -363,15 +364,16 @@ function Match(props) {
363
364
  function resetErrorBoundaries() {}
364
365
  function ErrorBoundary(props) {
365
366
  let error,
366
- res,
367
- clean,
368
- sync = true;
367
+ res,
368
+ clean,
369
+ sync = true;
369
370
  const ctx = sharedConfig.context;
370
371
  const id = ctx.id + ctx.count;
371
372
  function displayFallback() {
372
373
  cleanNode(clean);
373
374
  ctx.writeResource(id, error, true);
374
- setHydrateContext({ ...ctx,
375
+ setHydrateContext({
376
+ ...ctx,
375
377
  count: 0
376
378
  });
377
379
  const f = props.fallback;
@@ -578,7 +580,8 @@ function Suspense(props) {
578
580
  }
579
581
  });
580
582
  function runSuspense() {
581
- setHydrateContext({ ...ctx,
583
+ setHydrateContext({
584
+ ...ctx,
582
585
  count: 0
583
586
  });
584
587
  return runWithOwner(o, () => {
@@ -602,18 +605,20 @@ function Suspense(props) {
602
605
  });
603
606
  done = ctx.async ? ctx.registerFragment(id) : undefined;
604
607
  if (ctx.async) {
605
- setHydrateContext({ ...ctx,
608
+ setHydrateContext({
609
+ ...ctx,
606
610
  count: 0,
607
611
  id: ctx.id + "0.f",
608
612
  noHydrate: true
609
613
  });
610
614
  const res = {
611
- t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
615
+ t: `<template id="pl-${id}"></template>${resolveSSRNode(props.fallback)}<!pl-${id}>`
612
616
  };
613
617
  setHydrateContext(ctx);
614
618
  return res;
615
619
  }
616
- setHydrateContext({ ...ctx,
620
+ setHydrateContext({
621
+ ...ctx,
617
622
  count: 0,
618
623
  id: ctx.id + "0.f"
619
624
  });
package/dist/server.js CHANGED
@@ -23,10 +23,10 @@ let Owner = null;
23
23
  function createRoot(fn, detachedOwner) {
24
24
  detachedOwner && (Owner = detachedOwner);
25
25
  const owner = Owner,
26
- root = fn.length === 0 ? UNOWNED : {
27
- context: null,
28
- owner
29
- };
26
+ root = fn.length === 0 ? UNOWNED : {
27
+ context: null,
28
+ owner
29
+ };
30
30
  Owner = root;
31
31
  let result;
32
32
  try {
@@ -262,7 +262,8 @@ function setHydrateContext(context) {
262
262
  sharedConfig.context = context;
263
263
  }
264
264
  function nextHydrateContext() {
265
- return sharedConfig.context ? { ...sharedConfig.context,
265
+ return sharedConfig.context ? {
266
+ ...sharedConfig.context,
266
267
  id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
267
268
  count: 0
268
269
  } : undefined;
@@ -309,23 +310,23 @@ function mergeProps(...sources) {
309
310
  }
310
311
  function splitProps(props, ...keys) {
311
312
  const descriptors = Object.getOwnPropertyDescriptors(props),
312
- split = k => {
313
- const clone = {};
314
- for (let i = 0; i < k.length; i++) {
315
- const key = k[i];
316
- if (descriptors[key]) {
317
- Object.defineProperty(clone, key, descriptors[key]);
318
- delete descriptors[key];
313
+ split = k => {
314
+ const clone = {};
315
+ for (let i = 0; i < k.length; i++) {
316
+ const key = k[i];
317
+ if (descriptors[key]) {
318
+ Object.defineProperty(clone, key, descriptors[key]);
319
+ delete descriptors[key];
320
+ }
319
321
  }
320
- }
321
- return clone;
322
- };
322
+ return clone;
323
+ };
323
324
  return keys.map(split).concat(split(Object.keys(descriptors)));
324
325
  }
325
326
  function simpleMap(props, wrap) {
326
327
  const list = props.each || [],
327
- len = list.length,
328
- fn = props.children;
328
+ len = list.length,
329
+ fn = props.children;
329
330
  if (len) {
330
331
  let mapped = Array(len);
331
332
  for (let i = 0; i < len; i++) mapped[i] = wrap(fn, list[i], i);
@@ -361,15 +362,16 @@ function Match(props) {
361
362
  function resetErrorBoundaries() {}
362
363
  function ErrorBoundary(props) {
363
364
  let error,
364
- res,
365
- clean,
366
- sync = true;
365
+ res,
366
+ clean,
367
+ sync = true;
367
368
  const ctx = sharedConfig.context;
368
369
  const id = ctx.id + ctx.count;
369
370
  function displayFallback() {
370
371
  cleanNode(clean);
371
372
  ctx.writeResource(id, error, true);
372
- setHydrateContext({ ...ctx,
373
+ setHydrateContext({
374
+ ...ctx,
373
375
  count: 0
374
376
  });
375
377
  const f = props.fallback;
@@ -576,7 +578,8 @@ function Suspense(props) {
576
578
  }
577
579
  });
578
580
  function runSuspense() {
579
- setHydrateContext({ ...ctx,
581
+ setHydrateContext({
582
+ ...ctx,
580
583
  count: 0
581
584
  });
582
585
  return runWithOwner(o, () => {
@@ -600,18 +603,20 @@ function Suspense(props) {
600
603
  });
601
604
  done = ctx.async ? ctx.registerFragment(id) : undefined;
602
605
  if (ctx.async) {
603
- setHydrateContext({ ...ctx,
606
+ setHydrateContext({
607
+ ...ctx,
604
608
  count: 0,
605
609
  id: ctx.id + "0.f",
606
610
  noHydrate: true
607
611
  });
608
612
  const res = {
609
- t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
613
+ t: `<template id="pl-${id}"></template>${resolveSSRNode(props.fallback)}<!pl-${id}>`
610
614
  };
611
615
  setHydrateContext(ctx);
612
616
  return res;
613
617
  }
614
- setHydrateContext({ ...ctx,
618
+ setHydrateContext({
619
+ ...ctx,
615
620
  count: 0,
616
621
  id: ctx.id + "0.f"
617
622
  });