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.deps.json +1 -1
- package/node.js +12 -1
- package/node.js.map +1 -1
- package/node.mjs +12 -1
- package/node.test.js +37 -1
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +12 -1
- package/web.js.map +1 -1
- package/web.mjs +12 -1
- package/web.test.js +25 -0
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -782,7 +782,18 @@ var $;
|
|
|
782
782
|
}
|
|
783
783
|
if (!$mol_promise_like(this.cache))
|
|
784
784
|
return this.cache;
|
|
785
|
-
await
|
|
785
|
+
await Promise.race([
|
|
786
|
+
this.cache,
|
|
787
|
+
new Promise(done => {
|
|
788
|
+
const sub = new $mol_wire_pub_sub;
|
|
789
|
+
const prev = sub.track_on();
|
|
790
|
+
sub.track_next(this);
|
|
791
|
+
sub.track_off(prev);
|
|
792
|
+
sub.absorb = done;
|
|
793
|
+
})
|
|
794
|
+
]);
|
|
795
|
+
if (!$mol_promise_like(this.cache))
|
|
796
|
+
return this.cache;
|
|
786
797
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
787
798
|
await new Promise(() => { });
|
|
788
799
|
}
|
package/web.test.js
CHANGED
|
@@ -1827,6 +1827,31 @@ var $;
|
|
|
1827
1827
|
var $;
|
|
1828
1828
|
(function ($_1) {
|
|
1829
1829
|
$mol_test({
|
|
1830
|
+
async 'Error caching'($) {
|
|
1831
|
+
const next_cached = 123;
|
|
1832
|
+
class Some extends $mol_object2 {
|
|
1833
|
+
static $ = $;
|
|
1834
|
+
static data(id, next) {
|
|
1835
|
+
if (next)
|
|
1836
|
+
return next;
|
|
1837
|
+
setTimeout(() => {
|
|
1838
|
+
$mol_wire_async(this).data(id, next_cached);
|
|
1839
|
+
}, 10);
|
|
1840
|
+
$mol_fail_hidden(new Promise(() => { }));
|
|
1841
|
+
}
|
|
1842
|
+
static run() {
|
|
1843
|
+
return this.data('1');
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
__decorate([
|
|
1847
|
+
$mol_wire_plex
|
|
1848
|
+
], Some, "data", null);
|
|
1849
|
+
__decorate([
|
|
1850
|
+
$mol_wire_method
|
|
1851
|
+
], Some, "run", null);
|
|
1852
|
+
const val = await $mol_wire_async(Some).run();
|
|
1853
|
+
$mol_assert_equal(val, next_cached);
|
|
1854
|
+
},
|
|
1830
1855
|
'Memoize by single simple key'($) {
|
|
1831
1856
|
class Team extends $mol_object2 {
|
|
1832
1857
|
static $ = $;
|