-
-
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(replay): Disable mousemove sampling in rrweb for iOS browsers (#1…
…4937) This PR updates the rrweb sampling options depending on the userAgent as this tends to block the main thread on iOS browsers. closes #14534
- Loading branch information
Showing
4 changed files
with
79 additions
and
1 deletion.
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
22 changes: 22 additions & 0 deletions
22
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,22 @@ | ||
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?.userAgent ?? '') || | ||
(/Macintosh/i.test(NAVIGATOR?.userAgent ?? '') && 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