Skip to content

Use of Array.toSorted is not supported in all browsers #16759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
somatothing opened this issue Feb 28, 2025 · 6 comments · Fixed by #17307
Closed

Use of Array.toSorted is not supported in all browsers #16759

somatothing opened this issue Feb 28, 2025 · 6 comments · Fixed by #17307
Labels
must-do Issues that must be completed by the end of the Sprint. Or else. Only humans may set this. needs-triage Issue that require triage site Area: frontend dashboard

Comments

@somatothing
Copy link

Version
v2.19.0+2f32b11

Path
/templates

Error
TypeError: undefined is not a function (near '...e.toSorted...')

CJ@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:538:1768843
hqe@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:588:1783487
gA@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:46:94103
OC@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:48:108242
wq@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:48:144921
yie@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:48:144847
yb@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:48:144698
UC@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:48:141059
bq@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:48:140006
bq@[native code]
k@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:33:30049
P@https://ult7o8di4onoi.pit-1.try.coder.app/assets/index-rRHdo9Ka.js:33:30411
@janLo
Copy link
Contributor

janLo commented Mar 13, 2025

Similar to #7836 this is due to the usage of "newer" JS API. Array:toSorted() is available in Firefox 115 which was released in July 2023: https://caniuse.com/?search=Array.toSorted

@matifali matifali added needs-triage Issue that require triage site Area: frontend dashboard labels Mar 13, 2025
@dannykopping
Copy link
Contributor

@BrunoQuaresma I believe this was introduced in #15964:

return proxies.toSorted((a, b) => {

@dannykopping dannykopping changed the title Dunno what's up whit this ;P Use of Array.toSorted is not supported in all browsers Mar 18, 2025
@dannykopping
Copy link
Contributor

@somatothing can you please share which browser, version, and OS you are using?

@bpmct bpmct added the must-do Issues that must be completed by the end of the Sprint. Or else. Only humans may set this. label Apr 8, 2025
@bpmct
Copy link
Member

bpmct commented Apr 8, 2025

Looks like another one of our users is running into this, bringing this as a candidate for our next sprint context

@Parkreiner
Copy link
Member

Parkreiner commented Apr 9, 2025

@bpmct Would you have any problems if I get a fix in today? This should be such an easy fix that I should be able to get this started and wrapped up in less than 30 minutes

@bpmct
Copy link
Member

bpmct commented Apr 9, 2025

@Parkreiner no problems on my side!!

johnstcn pushed a commit that referenced this issue Apr 10, 2025
…e.sort` bugs (#17307)

Closes #16759

## Changes made
- Replaced all instances of `Array.prototype.toSorted` with
`Array.prototype.sort` to provide better support for older browsers
- Updated all `Array.prototype.sort` calls where necessary to remove
risks of mutation render bugs
- Refactored some code (moved things around, added comments) to make it
more clear that certain `.sort` calls are harmless and don't have any
risks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
must-do Issues that must be completed by the end of the Sprint. Or else. Only humans may set this. needs-triage Issue that require triage site Area: frontend dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants