jazz-tools 0.13.18 → 0.13.19

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.13.18 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.13.19 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -11,12 +11,12 @@
11
11
  ESM Build start
12
12
  ESM dist/index.js 1.48 KB
13
13
  ESM dist/testing.js 6.27 KB
14
- ESM dist/chunk-ITSHLDQB.js 121.15 KB
14
+ ESM dist/chunk-4HBHY4I7.js 121.39 KB
15
15
  ESM dist/index.js.map 258.00 B
16
16
  ESM dist/testing.js.map 12.38 KB
17
- ESM dist/chunk-ITSHLDQB.js.map 278.31 KB
18
- ESM ⚡️ Build success in 35ms
17
+ ESM dist/chunk-4HBHY4I7.js.map 279.08 KB
18
+ ESM ⚡️ Build success in 39ms
19
19
 
20
- > jazz-tools@0.13.18 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.13.19 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.13.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 80530a4: Improve error management for autoloaded values and fix autoloading on $each resolve
8
+
3
9
  ## 0.13.18
4
10
 
5
11
  ### Patch Changes
@@ -191,6 +191,7 @@ var SubscriptionScope = class _SubscriptionScope {
191
191
  this.dirty = false;
192
192
  this.idsSubscribed = /* @__PURE__ */ new Set();
193
193
  this.autoloaded = /* @__PURE__ */ new Set();
194
+ this.autoloadedKeys = /* @__PURE__ */ new Set();
194
195
  this.totalValidTransactions = 0;
195
196
  this.silenceUpdates = false;
196
197
  this.handleChildUpdate = (id, value, key) => {
@@ -289,7 +290,10 @@ var SubscriptionScope = class _SubscriptionScope {
289
290
  if (this.childErrors.size === 0 && this.validationErrors.size === 0) {
290
291
  return void 0;
291
292
  }
292
- for (const value of this.childErrors.values()) {
293
+ for (const [key, value] of this.childErrors.entries()) {
294
+ if (this.autoloaded.has(key)) {
295
+ continue;
296
+ }
293
297
  errorType = value.type;
294
298
  if (value.issues) {
295
299
  issues.push(...value.issues);
@@ -301,7 +305,10 @@ var SubscriptionScope = class _SubscriptionScope {
301
305
  issues.push(...value.issues);
302
306
  }
303
307
  }
304
- return new JazzError(this.id, errorType, issues);
308
+ if (issues.length) {
309
+ return new JazzError(this.id, errorType, issues);
310
+ }
311
+ return void 0;
305
312
  }
306
313
  shouldSendUpdates() {
307
314
  if (this.value.type === "unloaded") return false;
@@ -345,6 +352,7 @@ var SubscriptionScope = class _SubscriptionScope {
345
352
  return;
346
353
  }
347
354
  this.resolve[key] = true;
355
+ this.autoloadedKeys.add(key);
348
356
  if (this.value.type !== "loaded") {
349
357
  return;
350
358
  }
@@ -352,16 +360,10 @@ var SubscriptionScope = class _SubscriptionScope {
352
360
  this.silenceUpdates = true;
353
361
  if (value._type === "CoMap" || value._type === "Account") {
354
362
  const map = value;
355
- const id = this.loadCoMapKey(map, key, true);
356
- if (id) {
357
- this.autoloaded.add(id);
358
- }
363
+ this.loadCoMapKey(map, key, true);
359
364
  } else if (value._type === "CoList") {
360
365
  const list = value;
361
- const id = this.loadCoListKey(list, key, true);
362
- if (id) {
363
- this.autoloaded.add(id);
364
- }
366
+ this.loadCoListKey(list, key, true);
365
367
  }
366
368
  this.silenceUpdates = false;
367
369
  }
@@ -537,10 +539,14 @@ var SubscriptionScope = class _SubscriptionScope {
537
539
  if (this.childValues.has(id)) {
538
540
  return;
539
541
  }
542
+ if (key && this.autoloadedKeys.has(key)) {
543
+ this.autoloaded.add(id);
544
+ }
545
+ const resolve = typeof query === "object" && query !== null ? { ...query } : query;
540
546
  this.childValues.set(id, { type: "unloaded", id });
541
547
  const child = new _SubscriptionScope(
542
548
  this.node,
543
- query,
549
+ resolve,
544
550
  id,
545
551
  descriptor
546
552
  );
@@ -4220,4 +4226,4 @@ export {
4220
4226
  consumeInviteLink
4221
4227
  };
4222
4228
  /* istanbul ignore file -- @preserve */
4223
- //# sourceMappingURL=chunk-ITSHLDQB.js.map
4229
+ //# sourceMappingURL=chunk-4HBHY4I7.js.map