getsentry / getsentry/sentry-javascript

Angular change detection problems in Replay

Open
#12,443 3 comments 1 reaction 0 assignees View on GitHub
Angular Improvement Replays
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

Angular monkeypatches [browser APIs](https://github.com/angular/angular/blob/main/packages/zone.js/STANDARD-APIS.md) so that when they are called, will trigger Angular's change detection. This means that our SDK can end up causing customer applications to unnecessarily re-render, which in turn causes our Replay SDK to perform more work and can even cause performance regressions.

Some example areas where this happens:
* In the `rrweb-snapshot` package, [`snapshot.ts`](https://github.com/getsentry/rrweb/blob/sentry-v2/packages/rrweb-snapshot/src/snapshot.ts) is using the global `setTimeout` and `clearTimeout` functions, which are monkeypatched by Angular and triggers their change detection.
* `Promise`
* Any `EventTarget` (e.g. `window`, `Performance`, `Worker`)

Related to https://github.com/getsentry/sentry-javascript/issues/11661

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.