Skip to content

Commit

Permalink
close #501 do not count attach iframe event in checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyz0112 committed Feb 27, 2021
1 parent e558743 commit 860ff38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/record/iframe-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class IframeManager {
removes: [],
texts: [],
attributes: [],
isAttachIframe: true,
});
this.loadListener?.((iframeEl as unknown) as HTMLIFrameElement);
}
Expand Down
8 changes: 8 additions & 0 deletions src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ function record<T = eventWithTime>(
lastFullSnapshotEvent = e;
incrementalSnapshotCount = 0;
} else if (e.type === EventType.IncrementalSnapshot) {
// attch iframe should be considered as full snapshot
if (
e.data.source === IncrementalSource.Mutation &&
e.data.isAttachIframe
) {
return;
}

incrementalSnapshotCount++;
const exceedCount =
checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export type SamplingStrategy = Partial<{
* number is the throttle threshold of mouse/touch move callback
*/
mousemoveCallback: number;
/**
/**
* false means not to record mouse interaction events
* can also specify record some kinds of mouse interactions
*/
Expand Down Expand Up @@ -297,6 +297,7 @@ type mutationCallbackParam = {
attributes: attributeMutation[];
removes: removedNodeMutation[];
adds: addedNodeMutation[];
isAttachIframe?: true;
};

export type mutationCallBack = (m: mutationCallbackParam) => void;
Expand Down

2 comments on commit 860ff38

@eoghanmurray
Copy link
Contributor

Choose a reason for hiding this comment

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

The isAttachIframe marker is only relevant during recording?
Could we change it so that it's not part of the mutationCallbackParam type, e.g. make a new type (iFrameMutationCallbackParam?) and then discard the isAttachIframe attribute and coerce back to mutationCallbackParam before emission?
Or could it potentially be useful on the replay side?
(I'm trying to reason about how we can potentially batch up mutations during replay).

@Yuyz0112
Copy link
Member Author

Choose a reason for hiding this comment

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

@eoghanmurray yes, we can discard the isAttachIframe attribute.

Please sign in to comment.