mol_jsx_lib 0.0.660 → 0.0.661

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/web.mjs CHANGED
@@ -1036,7 +1036,18 @@ var $;
1036
1036
  }
1037
1037
  if (!$mol_promise_like(this.cache))
1038
1038
  return this.cache;
1039
- await this.cache;
1039
+ await Promise.race([
1040
+ this.cache,
1041
+ new Promise(done => {
1042
+ const sub = new $mol_wire_pub_sub;
1043
+ const prev = sub.track_on();
1044
+ sub.track_next(this);
1045
+ sub.track_off(prev);
1046
+ sub.absorb = done;
1047
+ })
1048
+ ]);
1049
+ if (!$mol_promise_like(this.cache))
1050
+ return this.cache;
1040
1051
  if (this.cursor === $mol_wire_cursor.final) {
1041
1052
  await new Promise(() => { });
1042
1053
  }
package/web.test.js CHANGED
@@ -1676,6 +1676,31 @@ var $;
1676
1676
  var $;
1677
1677
  (function ($_1) {
1678
1678
  $mol_test({
1679
+ async 'Error caching'($) {
1680
+ const next_cached = 123;
1681
+ class Some extends $mol_object2 {
1682
+ static $ = $;
1683
+ static data(id, next) {
1684
+ if (next)
1685
+ return next;
1686
+ setTimeout(() => {
1687
+ $mol_wire_async(this).data(id, next_cached);
1688
+ }, 10);
1689
+ $mol_fail_hidden(new Promise(() => { }));
1690
+ }
1691
+ static run() {
1692
+ return this.data('1');
1693
+ }
1694
+ }
1695
+ __decorate([
1696
+ $mol_wire_plex
1697
+ ], Some, "data", null);
1698
+ __decorate([
1699
+ $mol_wire_method
1700
+ ], Some, "run", null);
1701
+ const val = await $mol_wire_async(Some).run();
1702
+ $mol_assert_equal(val, next_cached);
1703
+ },
1679
1704
  'Memoize by single simple key'($) {
1680
1705
  class Team extends $mol_object2 {
1681
1706
  static $ = $;