Repository navigation
fix(app): support web startup without Array.toSorted - #65360
jipeng6036-del wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
This works as intended. I built the app on the base and on this pull request, served it with opencode serve from source, and loaded it in headless Chromium with Array.prototype.toSorted deleted before any page script ran. On the base the app shows the "Something went wrong" screen. With this change it shows "Connect to a server", the same as it does with the native method. The new e2e test fails on the base and passes here. polyfills.test.ts and tsc -b pass.
The fallback behaves like native toSorted for empty slots, undefined and a non-function comparator. It is non-enumerable and leaves the original array unchanged. The app's other newer array calls (findLast, findLastIndex) are already supported by the browsers affected here.
The public API is unchanged.
No blocking concerns.


Issue for this PR
Closes #65348
Type of change
What does this PR do?
Load a copy-and-sort fallback from the existing web polyfills when the browser lacks Array.prototype.toSorted. Plugin command registration can then finish on older WebViews.
Thanks to @ddingning for identifying the startup failure and confirming the workaround.
How did you verify your code works?
With toSorted removed before navigation, the original app shows the reported TypeError. The built app opens Home and shows the expected project. The Home suite passed all 23 tests, and the new case passed 10 repetitions with five workers. App unit and browser tests and the Linux repo check passed. The separate E2E typecheck reports the same 196 diagnostics on both revisions.
Screenshots / recordings
The regression checks the app's startup and the project list in Chromium.
Checklist