Skip to content

fix(site): resolve all Array.prototype.toSorted and Array.prototype.sort bugs #17307

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

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

Parkreiner
Copy link
Member

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

@Parkreiner Parkreiner requested a review from jaaydenh April 9, 2025 13:44
@Parkreiner Parkreiner self-assigned this Apr 9, 2025
key={usage.slug}
css={{ display: "flex", gap: 24, alignItems: "center" }}
>
{validUsage.map((usage, i) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

None of the code content changed here. The indentation only changed because I moved the .sort call up, to make it more obvious that it wasn't causing any harmful mutations

Copy link
Contributor

@jaaydenh jaaydenh left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Parkreiner Parkreiner merged commit a03a54d into main Apr 9, 2025
36 checks passed
@Parkreiner Parkreiner deleted the mes/toSorted branch April 9, 2025 19:17
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of Array.toSorted is not supported in all browsers
2 participants