feat(replay): Use unwrapped `setTimeout` to avoid e.g. angular change detection
This PR makes sure we use the native, unwrapped setTimeout implementation of the browser. Some environments, e.g. Angular, monkey patch this for their change detection, leading to performance issues (possibly). We have already changed this in rrweb, but we also have some usage of this in replay itself.
This PR should work fine, however all test fail today because we heavily use jest.useFakeTimers(), which basically monkey patches fetch too. So with this change, we do not use the patched timers, leading to everything blowing up 🤯
Based on https://github.com/getsentry/sentry-javascript/pull/11864 Depends on https://github.com/getsentry/sentry-javascript/pull/11899
size-limit report 📦
| Path | Size |
|---|---|
| @sentry/browser | 21.77 KB (+0.25% 🔺) |
| @sentry/browser (incl. Tracing) | 32.92 KB (+0.13% 🔺) |
| @sentry/browser (incl. Tracing, Replay) | 68.26 KB (+0.05% 🔺) |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 61.68 KB (+0.11% 🔺) |
| @sentry/browser (incl. Tracing, Replay with Canvas) | 72.29 KB (+0.04% 🔺) |
| @sentry/browser (incl. Tracing, Replay, Feedback) | 84.33 KB (+0.05% 🔺) |
| @sentry/browser (incl. Feedback) | 37.77 KB (+0.16% 🔺) |
| @sentry/browser (incl. sendFeedback) | 26.34 KB (+0.21% 🔺) |
| @sentry/browser (incl. FeedbackAsync) | 30.75 KB (+0.18% 🔺) |
| @sentry/react | 24.45 KB (+0.17% 🔺) |
| @sentry/react (incl. Tracing) | 35.89 KB (+0.08% 🔺) |
| @sentry/vue | 25.72 KB (+0.25% 🔺) |
| @sentry/vue (incl. Tracing) | 34.74 KB (+0.13% 🔺) |
| @sentry/svelte | 21.91 KB (+0.26% 🔺) |
| CDN Bundle | 24.29 KB (+0.12% 🔺) |
| CDN Bundle (incl. Tracing) | 34.34 KB (+0.08% 🔺) |
| CDN Bundle (incl. Tracing, Replay) | 68.04 KB (+0.06% 🔺) |
| CDN Bundle (incl. Tracing, Replay, Feedback) | 73.03 KB (+0.05% 🔺) |
| CDN Bundle - uncompressed | 71.42 KB (+0.13% 🔺) |
| CDN Bundle (incl. Tracing) - uncompressed | 101.84 KB (+0.1% 🔺) |
| CDN Bundle (incl. Tracing, Replay) - uncompressed | 211.46 KB (+0.05% 🔺) |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 223.82 KB (+0.05% 🔺) |
| @sentry/nextjs (client) | 35.17 KB (+0.23% 🔺) |
| @sentry/sveltekit (client) | 33.52 KB (+0.21% 🔺) |
| @sentry/node | 134.17 KB (0%) |
| @sentry/aws-serverless | 128.18 KB (0%) |
tracing/metrics/ tests are flaking a lot, not sure if related to this change specifically