-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(v8/replay): Disable mousemove sampling in rrweb for iOS browsers (#…
- Loading branch information
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/replay-internal/src/util/getRecordingSamplingOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { GLOBAL_OBJ } from '@sentry/core'; | ||
|
||
const NAVIGATOR = GLOBAL_OBJ.navigator; | ||
|
||
/** | ||
* Disable sampling mousemove events on iOS browsers as this can cause blocking the main thread | ||
* https://github.com/getsentry/sentry-javascript/issues/14534 | ||
*/ | ||
export function getRecordingSamplingOptions(): Partial<{ sampling: { mousemove: boolean } }> { | ||
if ( | ||
/iPhone|iPad|iPod/i.test((NAVIGATOR && NAVIGATOR.userAgent) || '') || | ||
(/Macintosh/i.test((NAVIGATOR && NAVIGATOR.userAgent) || '') && | ||
NAVIGATOR && | ||
NAVIGATOR.maxTouchPoints && | ||
NAVIGATOR.maxTouchPoints > 1) | ||
) { | ||
return { | ||
sampling: { | ||
mousemove: false, | ||
}, | ||
}; | ||
} | ||
|
||
return {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters