@glimt/record 0.0.78 → 0.0.79

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/dist/record.cjs CHANGED
@@ -10295,6 +10295,8 @@ const _ObserveManager = class _ObserveManager2 {
10295
10295
  __publicField(this, "shadowRootsObservers", /* @__PURE__ */ new WeakSet());
10296
10296
  __publicField(this, "mutationOptions");
10297
10297
  __publicField(this, "emitter", null);
10298
+ __publicField(this, "isSnapshottingShadowRoots", false);
10299
+ __publicField(this, "isSnapshottingDocs", false);
10298
10300
  if (_ObserveManager2.instance) {
10299
10301
  return _ObserveManager2.instance;
10300
10302
  }
@@ -10376,6 +10378,7 @@ const _ObserveManager = class _ObserveManager2 {
10376
10378
  this.emitShadowRoot(serialized, shadowRoot2);
10377
10379
  }
10378
10380
  onDocObserver(doc) {
10381
+ if (this.isSnapshottingDocs) return false;
10379
10382
  if (!this.usable) return false;
10380
10383
  if (!this.docsObservers.has(doc)) {
10381
10384
  this.docsObservers.add(doc);
@@ -10385,10 +10388,13 @@ const _ObserveManager = class _ObserveManager2 {
10385
10388
  "onDocObserver: doc already observed, emitting full snapshot for doc",
10386
10389
  doc
10387
10390
  );
10391
+ this.isSnapshottingDocs = true;
10388
10392
  this.serializeAndEmitDoc(doc);
10393
+ this.isSnapshottingDocs = false;
10389
10394
  return false;
10390
10395
  }
10391
10396
  onShadowRootObserver(shadowRoot2) {
10397
+ if (this.isSnapshottingShadowRoots) return false;
10392
10398
  if (!this.usable) return false;
10393
10399
  if (!this.shadowRootsObservers.has(shadowRoot2)) {
10394
10400
  this.shadowRootsObservers.add(shadowRoot2);
@@ -10398,7 +10404,9 @@ const _ObserveManager = class _ObserveManager2 {
10398
10404
  "onShadowRootObserver: shadowRoot already observed, emitting full snapshot for shadowRoot",
10399
10405
  shadowRoot2
10400
10406
  );
10407
+ this.isSnapshottingShadowRoots = true;
10401
10408
  this.serializeAndEmitShadowRoot(shadowRoot2);
10409
+ this.isSnapshottingShadowRoots = false;
10402
10410
  return false;
10403
10411
  }
10404
10412
  // canObserveDoc(doc: Document) {