solid-js 1.3.0-rc.0 → 1.3.0-rc.1

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
@@ -1480,19 +1480,21 @@ function Suspense(props) {
1480
1480
  if (sharedConfig.context) {
1481
1481
  const key = sharedConfig.context.id + sharedConfig.context.count;
1482
1482
  p = sharedConfig.load(key);
1483
- if (p && typeof p === "object") {
1484
- const [s, set] = createSignal(undefined, {
1485
- equals: false
1486
- });
1487
- flicker = s;
1488
- p.then(err => {
1489
- if (error = err) return set();
1490
- sharedConfig.gather(key);
1491
- setHydrateContext(ctx);
1492
- set();
1493
- setHydrateContext();
1494
- p = undefined;
1495
- });
1483
+ if (p) {
1484
+ if (typeof p !== "object" || !("then" in p)) error = p;else {
1485
+ const [s, set] = createSignal(undefined, {
1486
+ equals: false
1487
+ });
1488
+ flicker = s;
1489
+ p.then(err => {
1490
+ if (error = err) return set();
1491
+ sharedConfig.gather(key);
1492
+ setHydrateContext(ctx);
1493
+ set();
1494
+ setHydrateContext();
1495
+ p = undefined;
1496
+ });
1497
+ }
1496
1498
  }
1497
1499
  }
1498
1500
  const listContext = useContext(SuspenseListContext);
package/dist/dev.js CHANGED
@@ -1476,19 +1476,21 @@ function Suspense(props) {
1476
1476
  if (sharedConfig.context) {
1477
1477
  const key = sharedConfig.context.id + sharedConfig.context.count;
1478
1478
  p = sharedConfig.load(key);
1479
- if (p && typeof p === "object") {
1480
- const [s, set] = createSignal(undefined, {
1481
- equals: false
1482
- });
1483
- flicker = s;
1484
- p.then(err => {
1485
- if (error = err) return set();
1486
- sharedConfig.gather(key);
1487
- setHydrateContext(ctx);
1488
- set();
1489
- setHydrateContext();
1490
- p = undefined;
1491
- });
1479
+ if (p) {
1480
+ if (typeof p !== "object" || !("then" in p)) error = p;else {
1481
+ const [s, set] = createSignal(undefined, {
1482
+ equals: false
1483
+ });
1484
+ flicker = s;
1485
+ p.then(err => {
1486
+ if (error = err) return set();
1487
+ sharedConfig.gather(key);
1488
+ setHydrateContext(ctx);
1489
+ set();
1490
+ setHydrateContext();
1491
+ p = undefined;
1492
+ });
1493
+ }
1492
1494
  }
1493
1495
  }
1494
1496
  const listContext = useContext(SuspenseListContext);
package/dist/server.cjs CHANGED
@@ -482,7 +482,7 @@ function Suspense(props) {
482
482
  }
483
483
  const res = runSuspense();
484
484
  if (suspenseComplete(value)) {
485
- ctx.writeResource(id, true);
485
+ ctx.writeResource(id, null);
486
486
  return res;
487
487
  }
488
488
  onError(err => {
package/dist/server.js CHANGED
@@ -478,7 +478,7 @@ function Suspense(props) {
478
478
  }
479
479
  const res = runSuspense();
480
480
  if (suspenseComplete(value)) {
481
- ctx.writeResource(id, true);
481
+ ctx.writeResource(id, null);
482
482
  return res;
483
483
  }
484
484
  onError(err => {
package/dist/solid.cjs CHANGED
@@ -1404,19 +1404,21 @@ function Suspense(props) {
1404
1404
  if (sharedConfig.context) {
1405
1405
  const key = sharedConfig.context.id + sharedConfig.context.count;
1406
1406
  p = sharedConfig.load(key);
1407
- if (p && typeof p === "object") {
1408
- const [s, set] = createSignal(undefined, {
1409
- equals: false
1410
- });
1411
- flicker = s;
1412
- p.then(err => {
1413
- if (error = err) return set();
1414
- sharedConfig.gather(key);
1415
- setHydrateContext(ctx);
1416
- set();
1417
- setHydrateContext();
1418
- p = undefined;
1419
- });
1407
+ if (p) {
1408
+ if (typeof p !== "object" || !("then" in p)) error = p;else {
1409
+ const [s, set] = createSignal(undefined, {
1410
+ equals: false
1411
+ });
1412
+ flicker = s;
1413
+ p.then(err => {
1414
+ if (error = err) return set();
1415
+ sharedConfig.gather(key);
1416
+ setHydrateContext(ctx);
1417
+ set();
1418
+ setHydrateContext();
1419
+ p = undefined;
1420
+ });
1421
+ }
1420
1422
  }
1421
1423
  }
1422
1424
  const listContext = useContext(SuspenseListContext);
package/dist/solid.js CHANGED
@@ -1400,19 +1400,21 @@ function Suspense(props) {
1400
1400
  if (sharedConfig.context) {
1401
1401
  const key = sharedConfig.context.id + sharedConfig.context.count;
1402
1402
  p = sharedConfig.load(key);
1403
- if (p && typeof p === "object") {
1404
- const [s, set] = createSignal(undefined, {
1405
- equals: false
1406
- });
1407
- flicker = s;
1408
- p.then(err => {
1409
- if (error = err) return set();
1410
- sharedConfig.gather(key);
1411
- setHydrateContext(ctx);
1412
- set();
1413
- setHydrateContext();
1414
- p = undefined;
1415
- });
1403
+ if (p) {
1404
+ if (typeof p !== "object" || !("then" in p)) error = p;else {
1405
+ const [s, set] = createSignal(undefined, {
1406
+ equals: false
1407
+ });
1408
+ flicker = s;
1409
+ p.then(err => {
1410
+ if (error = err) return set();
1411
+ sharedConfig.gather(key);
1412
+ setHydrateContext(ctx);
1413
+ set();
1414
+ setHydrateContext();
1415
+ p = undefined;
1416
+ });
1417
+ }
1416
1418
  }
1417
1419
  }
1418
1420
  const listContext = useContext(SuspenseListContext);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.3.0-rc.0",
4
+ "version": "1.3.0-rc.1",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -144,5 +144,5 @@
144
144
  "compiler",
145
145
  "performance"
146
146
  ],
147
- "gitHead": "f6e6a9ff9efae848699f66900aa87f46b0707ea5"
147
+ "gitHead": "f39053a4af47e82f7e5dcca27b2c449209611c1d"
148
148
  }
package/web/dist/dev.cjs CHANGED
@@ -409,7 +409,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
409
409
  cleanChildren(parent, current, null, value);
410
410
  } else if (current == null || current === "" || !parent.firstChild) {
411
411
  parent.appendChild(value);
412
- } else parent.replaceChild(value, parent.firstChild);
412
+ } else parent.replaceChild(value, multi ? current : parent.firstChild);
413
413
  current = value;
414
414
  } else console.warn(`Unrecognized value. Skipped inserting`, value);
415
415
  return current;
package/web/dist/dev.js CHANGED
@@ -406,7 +406,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
406
406
  cleanChildren(parent, current, null, value);
407
407
  } else if (current == null || current === "" || !parent.firstChild) {
408
408
  parent.appendChild(value);
409
- } else parent.replaceChild(value, parent.firstChild);
409
+ } else parent.replaceChild(value, multi ? current : parent.firstChild);
410
410
  current = value;
411
411
  } else console.warn(`Unrecognized value. Skipped inserting`, value);
412
412
  return current;
@@ -232,7 +232,7 @@ function stringifyString(str) {
232
232
  return result;
233
233
  }
234
234
 
235
- const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y)}`;
235
+ const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
236
236
  const FRAGMENT_REPLACE = /<!\[([\d.]+)\]>/;
237
237
  function renderToString(code, options = {}) {
238
238
  let scripts = "";
@@ -268,7 +268,7 @@ function renderToStringAsync(code, options = {}) {
268
268
  nonce,
269
269
  writeResource(id, p, error) {
270
270
  if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
271
- if (typeof p !== "object" || !("then" in p)) return scripts += `_$HY.set("${id}", ${devalue(p)});`;
271
+ if (!p || typeof p !== "object" || !("then" in p)) return scripts += `_$HY.set("${id}", ${devalue(p)});`;
272
272
  p.then(d => scripts += `_$HY.set("${id}", ${devalue(d)});`).catch(() => scripts += `_$HY.set("${id}", {});`);
273
273
  }
274
274
  };
@@ -286,7 +286,7 @@ function renderToStringAsync(code, options = {}) {
286
286
  if (!registry.has(key)) return;
287
287
  cache[key] = value;
288
288
  registry.delete(key);
289
- if (error) scripts += `_$HY.set("${key}", Promise.resolve(${serializeError(error)}));`;else scripts += `_$HY.set("${key}", true);`;
289
+ if (error) scripts += `_$HY.set("${key}", Promise.resolve(${serializeError(error)}));`;else scripts += `_$HY.set("${key}", null);`;
290
290
  if (!registry.size) Promise.resolve().then(() => {
291
291
  let source = resolveSSRNode(rendered);
292
292
  let final = "";
@@ -356,7 +356,7 @@ function renderToStream(code, options = {}) {
356
356
  scheduled = true;
357
357
  }
358
358
  if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
359
- if (typeof p !== "object" || !("then" in p)) return tasks.push(`_$HY.set("${id}", ${devalue(p)})`);
359
+ if (!p || typeof p !== "object" || !("then" in p)) return tasks.push(`_$HY.set("${id}", ${devalue(p)})`);
360
360
  tasks.push(`_$HY.init("${id}")`);
361
361
  p.then(d => {
362
362
  !completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", ${devalue(d)})</script>`);
@@ -229,7 +229,7 @@ function stringifyString(str) {
229
229
  return result;
230
230
  }
231
231
 
232
- const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y)}`;
232
+ const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
233
233
  const FRAGMENT_REPLACE = /<!\[([\d.]+)\]>/;
234
234
  function renderToString(code, options = {}) {
235
235
  let scripts = "";
@@ -265,7 +265,7 @@ function renderToStringAsync(code, options = {}) {
265
265
  nonce,
266
266
  writeResource(id, p, error) {
267
267
  if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
268
- if (typeof p !== "object" || !("then" in p)) return scripts += `_$HY.set("${id}", ${devalue(p)});`;
268
+ if (!p || typeof p !== "object" || !("then" in p)) return scripts += `_$HY.set("${id}", ${devalue(p)});`;
269
269
  p.then(d => scripts += `_$HY.set("${id}", ${devalue(d)});`).catch(() => scripts += `_$HY.set("${id}", {});`);
270
270
  }
271
271
  };
@@ -283,7 +283,7 @@ function renderToStringAsync(code, options = {}) {
283
283
  if (!registry.has(key)) return;
284
284
  cache[key] = value;
285
285
  registry.delete(key);
286
- if (error) scripts += `_$HY.set("${key}", Promise.resolve(${serializeError(error)}));`;else scripts += `_$HY.set("${key}", true);`;
286
+ if (error) scripts += `_$HY.set("${key}", Promise.resolve(${serializeError(error)}));`;else scripts += `_$HY.set("${key}", null);`;
287
287
  if (!registry.size) Promise.resolve().then(() => {
288
288
  let source = resolveSSRNode(rendered);
289
289
  let final = "";
@@ -353,7 +353,7 @@ function renderToStream(code, options = {}) {
353
353
  scheduled = true;
354
354
  }
355
355
  if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
356
- if (typeof p !== "object" || !("then" in p)) return tasks.push(`_$HY.set("${id}", ${devalue(p)})`);
356
+ if (!p || typeof p !== "object" || !("then" in p)) return tasks.push(`_$HY.set("${id}", ${devalue(p)})`);
357
357
  tasks.push(`_$HY.init("${id}")`);
358
358
  p.then(d => {
359
359
  !completed && buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>_$HY.set("${id}", ${devalue(d)})</script>`);
package/web/dist/web.cjs CHANGED
@@ -408,7 +408,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
408
408
  cleanChildren(parent, current, null, value);
409
409
  } else if (current == null || current === "" || !parent.firstChild) {
410
410
  parent.appendChild(value);
411
- } else parent.replaceChild(value, parent.firstChild);
411
+ } else parent.replaceChild(value, multi ? current : parent.firstChild);
412
412
  current = value;
413
413
  } else ;
414
414
  return current;
package/web/dist/web.js CHANGED
@@ -405,7 +405,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
405
405
  cleanChildren(parent, current, null, value);
406
406
  } else if (current == null || current === "" || !parent.firstChild) {
407
407
  parent.appendChild(value);
408
- } else parent.replaceChild(value, parent.firstChild);
408
+ } else parent.replaceChild(value, multi ? current : parent.firstChild);
409
409
  current = value;
410
410
  } else ;
411
411
  return current;