Skip to content

Commit 4396196

Browse files
authored
fix(browser): Remove usage of Array.at() method (#16647)
Sentry SDK supported browsers: https://docs.sentry.io/platforms/javascript/troubleshooting/supported-browsers/ `.at` is ES2022: https://blog.saeloun.com/2022/02/24/ecmascript2022-adds-add-method/ The browser SDK supports ES2021 at the current moment, so we need to change this. Resolves #16646
1 parent 819d00e commit 4396196

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/browser-utils/src/metrics/web-vitals/lib/LayoutShiftManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export class LayoutShiftManager {
3030
if (entry.hadRecentInput) return;
3131

3232
const firstSessionEntry = this._sessionEntries[0];
33-
const lastSessionEntry = this._sessionEntries.at(-1);
33+
// This previously used `this._sessionEntries.at(-1)` but that is ES2022. We support ES2021 and earlier.
34+
const lastSessionEntry = this._sessionEntries[this._sessionEntries.length - 1];
3435

3536
// If the entry occurred less than 1 second after the previous entry
3637
// and less than 5 seconds after the first entry in the session,

0 commit comments

Comments
 (0)