Skip to content

Conversation

@bravecod
Copy link
Collaborator

…ap integration

Summary

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Jan 22, 2026

Add background capture support for Zoning/heatmaps by initializing SessionReplay.setupBackgroundCapture with BackgroundCaptureOptions and window messenger integration in session-replay.ts

Introduce BackgroundCaptureOptions, constants for origin and script URL, an async script loader, and a window-based messenger that SessionReplay initializes when backgroundCaptureOptions.enabled is true.

📍Where to Start

Start with SessionReplay.setupBackgroundCapture and initialization flow in session-replay.ts.


📊 Macroscope summarized f9b440d. 6 files reviewed, 6 issues evaluated, 1 issue filtered, 1 comment posted. View details (Automatic summaries will resume when PR exits draft mode or review begins).

},
{ once: true },
);
document.head?.appendChild(scriptElement);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If document.head is null, the optional chaining silently skips appendChild, leaving the promise pending forever. Consider removing ?. so the try/catch can reject the promise on failure.

Suggested change
document.head?.appendChild(scriptElement);
document.head.appendChild(scriptElement);

🚀 Want me to fix this? Reply ex: "fix it for me".

@bravecod bravecod force-pushed the feat-heatmap-background-capture branch from 2fcdd6e to f9b440d Compare January 27, 2026 19:04
}

try {
const { WindowMessenger } = await import('./libs/messenger');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WindowMessenger is not exported from ./libs/messenger — only types are defined there. This import will fail at runtime.

🚀 Want me to fix this? Reply ex: "fix it for me".

Comment on lines +71 to +72
const message = event.data as Message<Action>;
const { action, requestId, data } = message;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destructuring event.data will throw if the message is null or undefined. Consider adding a guard (e.g., if (!event.data) return) before destructuring.

Suggested change
const message = event.data as Message<Action>;
const { action, requestId, data } = message;
const message = event.data as Message<Action>;
if (!message) {
return;
}
const { action, requestId, data } = message;

🚀 Want me to fix this? Reply ex: "fix it for me".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants