Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/rrweb/scripts/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ void (async () => {
'window.__IS_RECORDING__',
);
if (!isRecording) {
// When the page navigates, I notice this event is emitted twice so that there are two recording processes running in a single page.
// Set recording flag True ASAP to prevent recording twice.
await recordedPage.evaluate('window.__IS_RECORDING__ = true');
await startRecording(recordedPage, serverURL);
}
});
Expand Down
4 changes: 4 additions & 0 deletions packages/rrweb/src/record/shadow-dom-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type BypassOptions = Omit<
};

export class ShadowDomManager {
private shadowDoms = new WeakSet<ShadowRoot>();
private mutationCb: mutationCallBack;
private scrollCb: scrollCallback;
private bypassOptions: BypassOptions;
Expand Down Expand Up @@ -55,6 +56,8 @@ export class ShadowDomManager {

public addShadowRoot(shadowRoot: ShadowRoot, doc: Document) {
if (!isNativeShadowDom(shadowRoot)) return;
if (this.shadowDoms.has(shadowRoot)) return;
this.shadowDoms.add(shadowRoot);
initMutationObserver(
{
...this.bypassOptions,
Expand Down Expand Up @@ -106,5 +109,6 @@ export class ShadowDomManager {

public reset() {
this.restorePatches.forEach((restorePatch) => restorePatch());
this.shadowDoms = new WeakSet();
}
}