mol_wire_lib 1.0.792 → 1.0.793

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
@@ -776,7 +776,18 @@ var $;
776
776
  }
777
777
  if (!$mol_promise_like(this.cache))
778
778
  return this.cache;
779
- await this.cache;
779
+ await Promise.race([
780
+ this.cache,
781
+ new Promise(done => {
782
+ const sub = new $mol_wire_pub_sub;
783
+ const prev = sub.track_on();
784
+ sub.track_next(this);
785
+ sub.track_off(prev);
786
+ sub.absorb = done;
787
+ })
788
+ ]);
789
+ if (!$mol_promise_like(this.cache))
790
+ return this.cache;
780
791
  if (this.cursor === $mol_wire_cursor.final) {
781
792
  await new Promise(() => { });
782
793
  }
package/node.test.js CHANGED
@@ -768,7 +768,18 @@ var $;
768
768
  }
769
769
  if (!$mol_promise_like(this.cache))
770
770
  return this.cache;
771
- await this.cache;
771
+ await Promise.race([
772
+ this.cache,
773
+ new Promise(done => {
774
+ const sub = new $mol_wire_pub_sub;
775
+ const prev = sub.track_on();
776
+ sub.track_next(this);
777
+ sub.track_off(prev);
778
+ sub.absorb = done;
779
+ })
780
+ ]);
781
+ if (!$mol_promise_like(this.cache))
782
+ return this.cache;
772
783
  if (this.cursor === $mol_wire_cursor.final) {
773
784
  await new Promise(() => { });
774
785
  }
@@ -4471,6 +4482,31 @@ var $;
4471
4482
  var $;
4472
4483
  (function ($_1) {
4473
4484
  $mol_test({
4485
+ async 'Error caching'($) {
4486
+ const next_cached = 123;
4487
+ class Some extends $mol_object2 {
4488
+ static $ = $;
4489
+ static data(id, next) {
4490
+ if (next)
4491
+ return next;
4492
+ setTimeout(() => {
4493
+ $mol_wire_async(this).data(id, next_cached);
4494
+ }, 10);
4495
+ $mol_fail_hidden(new Promise(() => { }));
4496
+ }
4497
+ static run() {
4498
+ return this.data('1');
4499
+ }
4500
+ }
4501
+ __decorate([
4502
+ $mol_wire_plex
4503
+ ], Some, "data", null);
4504
+ __decorate([
4505
+ $mol_wire_method
4506
+ ], Some, "run", null);
4507
+ const val = await $mol_wire_async(Some).run();
4508
+ $mol_assert_equal(val, next_cached);
4509
+ },
4474
4510
  'Memoize by single simple key'($) {
4475
4511
  class Team extends $mol_object2 {
4476
4512
  static $ = $;