@dabble/patches 0.7.5 → 0.7.6

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.
@@ -351,11 +351,12 @@ class PatchesSync {
351
351
  const existingIds = docIds.filter((id) => this.trackedDocs.has(id));
352
352
  if (!existingIds.length) return;
353
353
  existingIds.forEach((id) => this.trackedDocs.delete(id));
354
- if (this.state.connected) {
354
+ const unsubscribeIds = this.options?.subscribeFilter?.(existingIds) || existingIds;
355
+ if (this.state.connected && unsubscribeIds.length) {
355
356
  try {
356
- await this.ws.unsubscribe(existingIds);
357
+ await this.ws.unsubscribe(unsubscribeIds);
357
358
  } catch (err) {
358
- console.warn(`Failed to unsubscribe docs: ${existingIds.join(", ")}`, err);
359
+ console.warn(`Failed to unsubscribe docs: ${unsubscribeIds.join(", ")}`, err);
359
360
  }
360
361
  }
361
362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dabble/patches",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
5
5
  "author": "Jacob Wright <jacwright@gmail.com>",
6
6
  "bugs": {