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