Skip to content

fix(frontend): Polyfill ES2023 array methods for older WebKit engines - #132110

Open
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix-es2023-array-polyfills
Open

sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix-es2023-array-polyfills

Conversation

@sentry

@sentry sentry Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On older engines (such as iOS 15 WebKit on Safari and Chrome for iOS), the login page crashes inside GuideStore.updateCurrentGuide() with TypeError: r.toSorted is not a function.

Although our swc loader injects core-js polyfills in usage mode, it targets browserslist.production from package.json, which only covers the last 3 iOS major versions (iOS 16+). Because all supported targets have native implementations, no polyfill for toSorted (or related ES2023+ methods like toReversed, toSpliced, with, findLast, Object.groupBy, and Map.groupBy) is ever injected, causing immediate crashes at startup.

Solution

  1. Add static/app/utils/polyfills.ts explicitly importing core-js polyfills for toSorted, toReversed, toSpliced, with, findLast, findLastIndex, Object.groupBy, and Map.groupBy (core-js safely no-ops on browsers that already implement them).
  2. Load sentry/utils/polyfills as the very first import in static/app/utils/setupStatics.tsx, which runs before any app code in the app and gsAdmin entrypoints.
  3. Update knip.config.ts for the static/app workspace so knip knows core-js is now directly referenced rather than purely SWC-injected.
  4. Add unit tests covering the polyfills and restoring native prototypes after each test.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JAVASCRIPT-3GGD

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot requested a review from a team as a code owner November 21, 2026 22:47
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 21, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1e5a848. Configure here.

Comment thread static/app/utils/polyfills.ts Resolved

This branch was successfully deployed

1 active deployment
Preview — a64a0bc8 Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants