Skip to content

Commit

Permalink
Reduce verbosity/redundancy of output of new pointerType attribute by…
Browse files Browse the repository at this point in the history
… confining it only to clicks (and to a MouseDown/MouseUp from a PointerTypes.Pen, as these don't yet have a dedicated PendDown/PenUp)
  • Loading branch information
eoghanmurray committed Apr 13, 2023
1 parent c6ecd79 commit 2b2bd03
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 76 deletions.
9 changes: 9 additions & 0 deletions packages/rrweb/src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ function initMouseInteractionObserver({
}
if (pointerType !== null) {
currentPointerType = pointerType;
if (
(thisEventKey.substring(0, 5) === 'Touch' &&
pointerType === PointerTypes.Touch) ||
(thisEventKey.substring(0, 5) === 'Mouse' &&
pointerType === PointerTypes.Mouse)
) {
// don't output redundant info
pointerType = null;
}
} else if (MouseInteractions[eventKey] === MouseInteractions.Click) {
pointerType = currentPointerType;
currentPointerType = null; // cleanup as we've used it
Expand Down
102 changes: 34 additions & 68 deletions packages/rrweb/test/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1529,17 +1529,15 @@ exports[`record integration tests can record clicks 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 18,
\\"pointerType\\": 0
\\"id\\": 18
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 18,
\\"pointerType\\": 0
\\"id\\": 18
}
},
{
Expand All @@ -1556,17 +1554,15 @@ exports[`record integration tests can record clicks 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 7,
\\"id\\": 18,
\\"pointerType\\": 2
\\"id\\": 18
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 2,
\\"type\\": 9,
\\"id\\": 18,
\\"pointerType\\": 2
\\"id\\": 18
}
},
{
Expand All @@ -1583,8 +1579,7 @@ exports[`record integration tests can record clicks 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 21,
\\"pointerType\\": 0
\\"id\\": 21
}
},
{
Expand All @@ -1600,8 +1595,7 @@ exports[`record integration tests can record clicks 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 21,
\\"pointerType\\": 0
\\"id\\": 21
}
},
{
Expand Down Expand Up @@ -2135,8 +2129,7 @@ exports[`record integration tests can record form interactions 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand All @@ -2160,8 +2153,7 @@ exports[`record integration tests can record form interactions 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand Down Expand Up @@ -2196,8 +2188,7 @@ exports[`record integration tests can record form interactions 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand All @@ -2221,8 +2212,7 @@ exports[`record integration tests can record form interactions 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand Down Expand Up @@ -2915,8 +2905,7 @@ exports[`record integration tests can record node mutations 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 26,
\\"pointerType\\": 0
\\"id\\": 26
}
},
{
Expand Down Expand Up @@ -3373,8 +3362,7 @@ exports[`record integration tests can record node mutations 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 70,
\\"pointerType\\": 0
\\"id\\": 70
}
},
{
Expand Down Expand Up @@ -3921,8 +3909,7 @@ exports[`record integration tests can use maskInputOptions to configure which ty
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand All @@ -3946,8 +3933,7 @@ exports[`record integration tests can use maskInputOptions to configure which ty
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand Down Expand Up @@ -3982,8 +3968,7 @@ exports[`record integration tests can use maskInputOptions to configure which ty
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand All @@ -4007,8 +3992,7 @@ exports[`record integration tests can use maskInputOptions to configure which ty
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand Down Expand Up @@ -4972,8 +4956,7 @@ exports[`record integration tests mutations should work when blocked class is un
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 42,
\\"pointerType\\": 0
\\"id\\": 42
}
},
{
Expand All @@ -4989,8 +4972,7 @@ exports[`record integration tests mutations should work when blocked class is un
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 42,
\\"pointerType\\": 0
\\"id\\": 42
}
},
{
Expand Down Expand Up @@ -5098,8 +5080,7 @@ exports[`record integration tests mutations should work when blocked class is un
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 68,
\\"pointerType\\": 0
\\"id\\": 68
}
},
{
Expand All @@ -5123,8 +5104,7 @@ exports[`record integration tests mutations should work when blocked class is un
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 68,
\\"pointerType\\": 0
\\"id\\": 68
}
},
{
Expand Down Expand Up @@ -5692,8 +5672,7 @@ exports[`record integration tests should mask password value attribute with mask
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 20,
\\"pointerType\\": 0
\\"id\\": 20
}
},
{
Expand All @@ -5717,8 +5696,7 @@ exports[`record integration tests should mask password value attribute with mask
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 20,
\\"pointerType\\": 0
\\"id\\": 20
}
},
{
Expand Down Expand Up @@ -5803,8 +5781,7 @@ exports[`record integration tests should mask password value attribute with mask
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 20,
\\"pointerType\\": 0
\\"id\\": 20
}
},
{
Expand All @@ -5828,8 +5805,7 @@ exports[`record integration tests should mask password value attribute with mask
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 20,
\\"pointerType\\": 0
\\"id\\": 20
}
},
{
Expand Down Expand Up @@ -8537,8 +8513,7 @@ exports[`record integration tests should not record input values if maskAllInput
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand All @@ -8562,8 +8537,7 @@ exports[`record integration tests should not record input values if maskAllInput
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand Down Expand Up @@ -8598,8 +8572,7 @@ exports[`record integration tests should not record input values if maskAllInput
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand All @@ -8623,8 +8596,7 @@ exports[`record integration tests should not record input values if maskAllInput
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand Down Expand Up @@ -10574,17 +10546,15 @@ exports[`record integration tests should record dynamic CSS changes 1`] = `
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 26,
\\"pointerType\\": 0
\\"id\\": 26
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 26,
\\"pointerType\\": 0
\\"id\\": 26
}
},
{
Expand Down Expand Up @@ -12255,8 +12225,7 @@ exports[`record integration tests should record input userTriggered values if us
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand All @@ -12280,8 +12249,7 @@ exports[`record integration tests should record input userTriggered values if us
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 27,
\\"pointerType\\": 0
\\"id\\": 27
}
},
{
Expand Down Expand Up @@ -12318,8 +12286,7 @@ exports[`record integration tests should record input userTriggered values if us
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand All @@ -12343,8 +12310,7 @@ exports[`record integration tests should record input userTriggered values if us
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 37,
\\"pointerType\\": 0
\\"id\\": 37
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1667,8 +1667,7 @@ exports[`cross origin iframes form.html should map input events correctly 1`] =
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 39,
\\"pointerType\\": 0
\\"id\\": 39
}
},
{
Expand All @@ -1692,8 +1691,7 @@ exports[`cross origin iframes form.html should map input events correctly 1`] =
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 39,
\\"pointerType\\": 0
\\"id\\": 39
}
},
{
Expand Down Expand Up @@ -1728,8 +1726,7 @@ exports[`cross origin iframes form.html should map input events correctly 1`] =
\\"data\\": {
\\"source\\": 2,
\\"type\\": 1,
\\"id\\": 49,
\\"pointerType\\": 0
\\"id\\": 49
}
},
{
Expand All @@ -1753,8 +1750,7 @@ exports[`cross origin iframes form.html should map input events correctly 1`] =
\\"data\\": {
\\"source\\": 2,
\\"type\\": 0,
\\"id\\": 49,
\\"pointerType\\": 0
\\"id\\": 49
}
},
{
Expand Down

0 comments on commit 2b2bd03

Please sign in to comment.