@sentry/replay 10.74.0 → 10.75.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.
@@ -4917,11 +4917,9 @@ const ATTRIBUTES_TO_RECORD = /* @__PURE__ */ new Set([
4917
4917
  "aria-disabled",
4918
4918
  "data-sentry-component"
4919
4919
  ]);
4920
+ const BREADCRUMB_RELEVANT_ATTRIBUTES = /* @__PURE__ */ new Set([...ATTRIBUTES_TO_RECORD, "data-sentry-element"]);
4920
4921
  function getAttributesToRecord(attributes) {
4921
4922
  const obj = {};
4922
- if (!attributes["data-sentry-component"] && attributes["data-sentry-element"]) {
4923
- attributes["data-sentry-component"] = attributes["data-sentry-element"];
4924
- }
4925
4923
  for (const key in attributes) {
4926
4924
  if (ATTRIBUTES_TO_RECORD.has(key)) {
4927
4925
  let normalizedKey = key;
@@ -4931,6 +4929,9 @@ function getAttributesToRecord(attributes) {
4931
4929
  obj[normalizedKey] = attributes[key];
4932
4930
  }
4933
4931
  }
4932
+ if (!obj["data-sentry-component"] && attributes["data-sentry-element"]) {
4933
+ obj["data-sentry-component"] = attributes["data-sentry-element"];
4934
+ }
4934
4935
  return obj;
4935
4936
  }
4936
4937
 
@@ -6919,15 +6920,24 @@ function syncMirrorAttributesFromMutationEvent(event) {
6919
6920
  for (const mutation of data.attributes) {
6920
6921
  const node = record.mirror.getNode(mutation.id);
6921
6922
  const meta = node && record.mirror.getMeta(node);
6922
- if (meta?.type !== NodeType.Element) {
6923
+ if (!node || meta?.type !== NodeType.Element) {
6923
6924
  continue;
6924
6925
  }
6926
+ const attributes = { ...meta.attributes };
6927
+ let changed = false;
6925
6928
  for (const [attributeName, value] of Object.entries(mutation.attributes)) {
6929
+ if (!BREADCRUMB_RELEVANT_ATTRIBUTES.has(attributeName)) {
6930
+ continue;
6931
+ }
6926
6932
  if (value === null) {
6927
- delete meta.attributes[attributeName];
6933
+ delete attributes[attributeName];
6928
6934
  } else {
6929
- meta.attributes[attributeName] = value;
6935
+ attributes[attributeName] = value;
6930
6936
  }
6937
+ changed = true;
6938
+ }
6939
+ if (changed) {
6940
+ record.mirror.add(node, { ...meta, attributes });
6931
6941
  }
6932
6942
  }
6933
6943
  }