@myko/ui-svelte 6.1.0 → 6.2.0

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.
@@ -5,7 +5,7 @@
5
5
  * Queries and reports are deduplicated - multiple calls with the same args share
6
6
  * the same subscription and are only cancelled when all consumers unsubscribe.
7
7
  */
8
- import { ConnectionStatus, MykoClient, MykoProtocol } from '@myko/core';
8
+ import { ConnectionStatus, MykoClient, MykoProtocol, applyCollectionDiff } from '@myko/core';
9
9
  import { SvelteMap } from 'svelte/reactivity';
10
10
  import { Subject } from 'rxjs';
11
11
  import { untrack } from 'svelte';
@@ -328,16 +328,7 @@ export class SvelteMykoClient {
328
328
  error = undefined;
329
329
  const subscription = this.client.watchQueryDiff(query).subscribe({
330
330
  next: (diff) => {
331
- if (diff.sequence === 0n) {
332
- items.clear();
333
- }
334
- for (const id of diff.deletes) {
335
- items.delete(id);
336
- }
337
- for (const item of diff.upserts) {
338
- const typedItem = item;
339
- items.set(typedItem.id, typedItem);
340
- }
331
+ applyCollectionDiff(items, diff);
341
332
  resolved = true;
342
333
  error = undefined;
343
334
  },
@@ -390,16 +381,7 @@ export class SvelteMykoClient {
390
381
  error = undefined;
391
382
  const subscription = this.client.watchViewDiff(view).subscribe({
392
383
  next: (diff) => {
393
- if (diff.sequence === 0n) {
394
- items.clear();
395
- }
396
- for (const id of diff.deletes) {
397
- items.delete(id);
398
- }
399
- for (const item of diff.upserts) {
400
- const typedItem = item;
401
- items.set(typedItem.id, typedItem);
402
- }
384
+ applyCollectionDiff(items, diff);
403
385
  resolved = true;
404
386
  error = undefined;
405
387
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@myko/core": "^6.1.0",
3
+ "@myko/core": "^6.2.0",
4
4
  "luxon": "^3.5.0",
5
5
  "ramda": "^0.30.1",
6
6
  "rxjs": "^7.8.1",
@@ -64,7 +64,7 @@
64
64
  "**/*.css"
65
65
  ],
66
66
  "type": "module",
67
- "version": "6.1.0",
67
+ "version": "6.2.0",
68
68
  "main": "./dist/index.js",
69
69
  "types": "./dist/index.d.ts"
70
70
  }