hyoo_sync_client 0.0.228 → 0.0.230

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
@@ -1924,12 +1924,26 @@ var $;
1924
1924
  }
1925
1925
  if (!$mol_promise_like(this.cache))
1926
1926
  return this.cache;
1927
- await this.cache;
1927
+ await Promise.race([this.cache, this.step()]);
1928
+ if (!$mol_promise_like(this.cache))
1929
+ return this.cache;
1928
1930
  if (this.cursor === $mol_wire_cursor.final) {
1929
1931
  await new Promise(() => { });
1930
1932
  }
1931
1933
  }
1932
1934
  }
1935
+ step() {
1936
+ return new Promise(done => {
1937
+ const sub = new $mol_wire_pub_sub;
1938
+ const prev = sub.track_on();
1939
+ sub.track_next(this);
1940
+ sub.track_off(prev);
1941
+ sub.absorb = () => {
1942
+ done(null);
1943
+ sub.destructor();
1944
+ };
1945
+ });
1946
+ }
1933
1947
  }
1934
1948
  $.$mol_wire_fiber = $mol_wire_fiber;
1935
1949
  })($ || ($ = {}));
package/node.test.js CHANGED
@@ -1916,12 +1916,26 @@ var $;
1916
1916
  }
1917
1917
  if (!$mol_promise_like(this.cache))
1918
1918
  return this.cache;
1919
- await this.cache;
1919
+ await Promise.race([this.cache, this.step()]);
1920
+ if (!$mol_promise_like(this.cache))
1921
+ return this.cache;
1920
1922
  if (this.cursor === $mol_wire_cursor.final) {
1921
1923
  await new Promise(() => { });
1922
1924
  }
1923
1925
  }
1924
1926
  }
1927
+ step() {
1928
+ return new Promise(done => {
1929
+ const sub = new $mol_wire_pub_sub;
1930
+ const prev = sub.track_on();
1931
+ sub.track_next(this);
1932
+ sub.track_off(prev);
1933
+ sub.absorb = () => {
1934
+ done(null);
1935
+ sub.destructor();
1936
+ };
1937
+ });
1938
+ }
1925
1939
  }
1926
1940
  $.$mol_wire_fiber = $mol_wire_fiber;
1927
1941
  })($ || ($ = {}));
@@ -6402,6 +6416,31 @@ var $;
6402
6416
  var $;
6403
6417
  (function ($_1) {
6404
6418
  $mol_test({
6419
+ async 'Error caching'($) {
6420
+ const next_cached = 123;
6421
+ class Some extends $mol_object2 {
6422
+ static $ = $;
6423
+ static data(id, next) {
6424
+ if (next)
6425
+ return next;
6426
+ setTimeout(() => {
6427
+ $mol_wire_async(this).data(id, next_cached);
6428
+ }, 10);
6429
+ $mol_fail_hidden(new Promise(() => { }));
6430
+ }
6431
+ static run() {
6432
+ return this.data('1');
6433
+ }
6434
+ }
6435
+ __decorate([
6436
+ $mol_wire_plex
6437
+ ], Some, "data", null);
6438
+ __decorate([
6439
+ $mol_wire_method
6440
+ ], Some, "run", null);
6441
+ const val = await $mol_wire_async(Some).run();
6442
+ $mol_assert_equal(val, next_cached);
6443
+ },
6405
6444
  'Memoize by single simple key'($) {
6406
6445
  class Team extends $mol_object2 {
6407
6446
  static $ = $;