Skip to content

fix(clients): replace toSorted with sort in bundled code - #14120

Closed
maximevast wants to merge 2 commits into
mainfrom
maxime/drop-es2023-tosorted
Closed

maximevast wants to merge 2 commits into
mainfrom
maxime/drop-es2023-tosorted

Conversation

@maximevast

@maximevast maximevast commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #14111

Bundled code can't use ES2023 APIs.

toSorted is ES2023.

Our floor is Next 16's default target, baseline widely available:
Chrome/Edge 111, Firefox 111, Safari 16.4. toSorted needs Firefox 115.

Checklist

  • This PR addresses a single concern (one bug fix, one feature, one refactor)
  • The diff is reasonably sized and easy to review
  • New functionality is covered by tests
  • Linting and type checking pass (uv run task lint && uv run task lint_types)
  • No unrelated changes or drive-by fixes are included

Review in cubic

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
orbit Ready Ready Preview Sep 3, 2026 8:40am UTC
polar-test Ready Ready Preview Sep 3, 2026 8:40am UTC

Request Review

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Fixes ES2023 incompatibility by replacing toSorted with sort in bundled client code, using spreads to avoid mutation. Bounded, focused change with no behavioral shift.

Re-trigger cubic

@sebastianekstrom sebastianekstrom 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.

Not sure we actually need this. It seems to be a very widely supported API: https://caniuse.com/?search=toSorted. Firefox 115 was released back in 2023, so people have had plenty of time to upgrade!

Copy link
Copy Markdown
Contributor Author

My reasoning was that it's in checkout and thus could be seen by a wide range of people. I agree that merchants are surely using an up to date browser, but was mainly thinking about customers.

Happy to discard if you think this is too far fetched.

This branch was successfully deployed

2 active deployments
Preview – polar-test — fbed696c Deployed Sep 3, 2026 by vercel[bot]
Preview – orbit — fbed696c Deployed Sep 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getMeteredTiers uses ES2023 Array.prototype.toSorted without fallback

3 participants