Commit 0d0fd78
authored
fix(replay): Ensure replays contain canvas rendering when resumed after inactivity (#18714)
Replays of apps that use canvas elements that are resumed after a long
period of inactivity (for example when navigating away and back to a tab
after 5 minutes) were previously broken.
Replays contained all DOM elements, including the canvas, but the canvas
would not have any of its rendering captured.
This happens because before resuming from inactivity, `getCanvasManager`
creates a new `CanvasManager` that is then passed to a promise resolve
function that was already resolved beforehand. That leads to the new
canvas manager not actually being used when returning from inactivity
and thus having all rendering attempted to be captured from the previous
canvas manager instead of the new one.
For backwards compatibility, I kept the promise based approach around
and added a second storage variable for the canvas manager.
I attempted to create integration tests but was not able to reproduce
this issue in an integration test so I opted for just a basic unit test.
I did reproduce this issue in a sample app locally and captured two
replays:
1) The [first
replay](https://sentry-sdks.sentry.io/explore/replays/26cd46702dc448148c0c887edaa10aec/?playlistEnd=2026-01-07T13%3A05%3A52&playlistStart=2026-01-07T12%3A05%3A52&project=4507937458552832&query=&referrer=replayList)
uses our CDN bundles and shows canvas rendering captured at first but
missing towards the end of the replay.
2) The [second
replay](https://sentry-sdks.sentry.io/explore/replays/765c4b98474242b0a0e690e16b59ab7f/?playlistEnd=2026-01-07T13%3A13%3A23&playlistStart=2026-01-07T12%3A13%3A23&project=4507937458552832&query=&referrer=replayList)
uses bundles built from this PR and shows canvas rendering continues
towards the end of the replay.
Closes: #186821 parent 40ec7f8 commit 0d0fd78
2 files changed
+35
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
107 | 112 | | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
114 | | - | |
| 120 | + | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
0 commit comments