mol_jsx_lib 0.0.660 → 0.0.662

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/node.mjs CHANGED
@@ -1633,12 +1633,26 @@ var $;
1633
1633
  }
1634
1634
  if (!$mol_promise_like(this.cache))
1635
1635
  return this.cache;
1636
- await this.cache;
1636
+ await Promise.race([this.cache, this.step()]);
1637
+ if (!$mol_promise_like(this.cache))
1638
+ return this.cache;
1637
1639
  if (this.cursor === $mol_wire_cursor.final) {
1638
1640
  await new Promise(() => { });
1639
1641
  }
1640
1642
  }
1641
1643
  }
1644
+ step() {
1645
+ return new Promise(done => {
1646
+ const sub = new $mol_wire_pub_sub;
1647
+ const prev = sub.track_on();
1648
+ sub.track_next(this);
1649
+ sub.track_off(prev);
1650
+ sub.absorb = () => {
1651
+ done(null);
1652
+ sub.destructor();
1653
+ };
1654
+ });
1655
+ }
1642
1656
  }
1643
1657
  $.$mol_wire_fiber = $mol_wire_fiber;
1644
1658
  })($ || ($ = {}));
package/node.test.js CHANGED
@@ -1625,12 +1625,26 @@ var $;
1625
1625
  }
1626
1626
  if (!$mol_promise_like(this.cache))
1627
1627
  return this.cache;
1628
- await this.cache;
1628
+ await Promise.race([this.cache, this.step()]);
1629
+ if (!$mol_promise_like(this.cache))
1630
+ return this.cache;
1629
1631
  if (this.cursor === $mol_wire_cursor.final) {
1630
1632
  await new Promise(() => { });
1631
1633
  }
1632
1634
  }
1633
1635
  }
1636
+ step() {
1637
+ return new Promise(done => {
1638
+ const sub = new $mol_wire_pub_sub;
1639
+ const prev = sub.track_on();
1640
+ sub.track_next(this);
1641
+ sub.track_off(prev);
1642
+ sub.absorb = () => {
1643
+ done(null);
1644
+ sub.destructor();
1645
+ };
1646
+ });
1647
+ }
1634
1648
  }
1635
1649
  $.$mol_wire_fiber = $mol_wire_fiber;
1636
1650
  })($ || ($ = {}));
@@ -4572,6 +4586,31 @@ var $;
4572
4586
  var $;
4573
4587
  (function ($_1) {
4574
4588
  $mol_test({
4589
+ async 'Error caching'($) {
4590
+ const next_cached = 123;
4591
+ class Some extends $mol_object2 {
4592
+ static $ = $;
4593
+ static data(id, next) {
4594
+ if (next)
4595
+ return next;
4596
+ setTimeout(() => {
4597
+ $mol_wire_async(this).data(id, next_cached);
4598
+ }, 10);
4599
+ $mol_fail_hidden(new Promise(() => { }));
4600
+ }
4601
+ static run() {
4602
+ return this.data('1');
4603
+ }
4604
+ }
4605
+ __decorate([
4606
+ $mol_wire_plex
4607
+ ], Some, "data", null);
4608
+ __decorate([
4609
+ $mol_wire_method
4610
+ ], Some, "run", null);
4611
+ const val = await $mol_wire_async(Some).run();
4612
+ $mol_assert_equal(val, next_cached);
4613
+ },
4575
4614
  'Memoize by single simple key'($) {
4576
4615
  class Team extends $mol_object2 {
4577
4616
  static $ = $;