@posthog/rrweb 0.0.21 → 0.0.23

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/rrweb.cjs CHANGED
@@ -16187,7 +16187,7 @@ class Replayer {
16187
16187
  this.virtualDom.mirror
16188
16188
  );
16189
16189
  } catch (e2) {
16190
- console.warn(e2);
16190
+ this.warn(e2);
16191
16191
  }
16192
16192
  this.virtualDom.destroyTree();
16193
16193
  this.usingVirtualDom = false;
@@ -17075,16 +17075,6 @@ class Replayer {
17075
17075
  ...this.legacy_missingNodeRetryMap
17076
17076
  };
17077
17077
  const queue = [];
17078
- const nextNotInDOM = (mutation) => {
17079
- let next = null;
17080
- if (mutation.nextId) {
17081
- next = mirror2.getNode(mutation.nextId);
17082
- }
17083
- if (mutation.nextId !== null && mutation.nextId !== void 0 && mutation.nextId !== -1 && !next) {
17084
- return true;
17085
- }
17086
- return false;
17087
- };
17088
17078
  const appendNode = (mutation) => {
17089
17079
  var _a2, _b;
17090
17080
  if (!this.iframe.contentDocument) {
@@ -17097,7 +17087,10 @@ class Replayer {
17097
17087
  if (mutation.node.type === NodeType.Document) {
17098
17088
  return this.newDocumentQueue.push(mutation);
17099
17089
  }
17100
- return queue.push(mutation);
17090
+ const parentIdInCurrentBatch = d.adds.some(
17091
+ (add) => add.node.id === mutation.parentId
17092
+ );
17093
+ return parentIdInCurrentBatch ? queue.push(mutation) : void 0;
17101
17094
  }
17102
17095
  if (mutation.node.isShadow) {
17103
17096
  if (!hasShadowRoot(parent)) {
@@ -17113,9 +17106,6 @@ class Replayer {
17113
17106
  if (mutation.nextId) {
17114
17107
  next = mirror2.getNode(mutation.nextId);
17115
17108
  }
17116
- if (nextNotInDOM(mutation)) {
17117
- return queue.push(mutation);
17118
- }
17119
17109
  if (mutation.node.rootId && !mirror2.getNode(mutation.node.rootId)) {
17120
17110
  return;
17121
17111
  }
@@ -17221,11 +17211,11 @@ class Replayer {
17221
17211
  d.adds.forEach((mutation) => {
17222
17212
  appendNode(mutation);
17223
17213
  });
17224
- const startTime = Date.now();
17214
+ const startTime = performance.now();
17225
17215
  while (queue.length) {
17226
17216
  const resolveTrees = queueToResolveTrees(queue);
17227
17217
  queue.length = 0;
17228
- if (Date.now() - startTime > 500) {
17218
+ if (performance.now() - startTime > 150) {
17229
17219
  this.warn(
17230
17220
  "Timeout in the loop, please check the resolve tree data:",
17231
17221
  resolveTrees