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