fix(landing): avoid unpolyfilled ES2023 array methods (toSorted/toReversed) in client code - #5340
Conversation
toSorted/toReversed require Safari 16+/iOS 16+ and Next.js/SWC does not polyfill prototype methods (vercel/next.js#58421 closed unmerged), so #5326 broke sorting on the models page and landing preview for Safari 15/iOS 15 with a runtime TypeError. Revert the 6 call sites to [...arr].sort()/[...arr].reverse() (immutable, universally supported, matches the existing codebase idiom) and drop the ES2023 tsconfig lib override that only existed to type-check them.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview All six call sites now use
Reviewed by Cursor Bugbot for commit 6677cb6. Configure here. |
Greptile SummaryThis PR fixes a runtime
Confidence Score: 5/5Safe to merge — all changes are minimal, targeted replacements of ES2023 array methods with universally-supported equivalents, plus a tsconfig cleanup that restores a type-level guardrail. Every substitution is semantically equivalent: [...arr].sort() and [...arr].reverse() produce the same immutable result as toSorted/toReversed and match the idiom used in eight other places in the codebase. The integrations/[slug]/page.tsx case calls .sort() directly on a fresh Array.from() result — no external array is mutated. Removing the ES2023 lib override from tsconfig.json is a one-line change that only restricts which type definitions are available, with no runtime effect. No new logic is introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Client renders landing page] --> B{Browser supports ES2023 Array methods?}
B -- Safari 16+ or Chrome or Firefox --> C[toSorted / toReversed works]
B -- Safari 15 or iOS 15 or older --> D[TypeError - method not found]
subgraph Fix Applied
E["spread array first: ...arr"] --> F["call .sort() or .reverse() on copy"]
F --> H[Original unchanged - all browsers supported]
end
D -- PR fix --> E
C -- PR fix --> E
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Client renders landing page] --> B{Browser supports ES2023 Array methods?}
B -- Safari 16+ or Chrome or Firefox --> C[toSorted / toReversed works]
B -- Safari 15 or iOS 15 or older --> D[TypeError - method not found]
subgraph Fix Applied
E["spread array first: ...arr"] --> F["call .sort() or .reverse() on copy"]
F --> H[Original unchanged - all browsers supported]
end
D -- PR fix --> E
C -- PR fix --> E
Reviews (1): Last reviewed commit: "fix(landing): avoid unpolyfilled ES2023 ..." | Re-trigger Greptile |
…nts, fix && partialize false positive - check:utils drops the ES2023 call-site detector; every tsconfig keeps lib at ES2022 so tsc rejects toSorted/with by type, and the check now fails a tsconfig that raises lib past it (the #5340 cause) - check:zustand-v5 treats only the right side of && as a returned value - check:explicit-any counts group-level and bare lint biome-ignore suppressions, and no longer pairs a deleted file with an unrelated new one as a rename - check:file-names drops its rule-matched rename hint, which pointed new violations at old baseline entries - check:comment-hygiene skips the parse for files with no possible hit and scans untracked files - inline the single-consumer source-kind helper and two leftover ref aliases - CLAUDE.md naming states the check:file-names scope; /ship runs type-check
…nts, fix && partialize false positive - check:utils drops the ES2023 call-site detector; every tsconfig keeps lib at ES2022 so tsc rejects toSorted/with by type, and the check now fails a tsconfig that raises lib past it (the #5340 cause) - check:zustand-v5 treats only the right side of && as a returned value - check:explicit-any counts group-level and bare lint biome-ignore suppressions, and no longer pairs a deleted file with an unrelated new one as a rename - check:file-names drops its rule-matched rename hint, which pointed new violations at old baseline entries - check:comment-hygiene skips the parse for files with no possible hit and scans untracked files - inline the single-consumer source-kind helper and two leftover ref aliases - CLAUDE.md naming states the check:file-names scope; /ship runs type-check
…release review (#8571) * fix(audits): close guardrail detector gaps and correct guidance from release review * fix(audits): detect partialize and .with by AST instead of regex * fix(audits): exempt only the imported OpenTelemetry context from the .with rule; unwrap cast partialize * fix(audits): drop the OTel exemption for rebound names, catch optional .with calls and defaulted partialize params * fix(audits): treat logical and conditional partialize returns of the whole state as leaks * improvement(audits): let tsc guard ES2023 methods, tighten ratchet hints, fix && partialize false positive - check:utils drops the ES2023 call-site detector; every tsconfig keeps lib at ES2022 so tsc rejects toSorted/with by type, and the check now fails a tsconfig that raises lib past it (the #5340 cause) - check:zustand-v5 treats only the right side of && as a returned value - check:explicit-any counts group-level and bare lint biome-ignore suppressions, and no longer pairs a deleted file with an unrelated new one as a rename - check:file-names drops its rule-matched rename hint, which pointed new violations at old baseline entries - check:comment-hygiene skips the parse for files with no possible hit and scans untracked files - inline the single-consumer source-kind helper and two leftover ref aliases - CLAUDE.md naming states the check:file-names scope; /ship runs type-check * chore(guidance): state the tsconfig lib invariant as at or below ES2022 * fix(audits): keep matching toSorted/toReversed/toSpliced in source for any receivers * chore(guidance): scope the ES2023 tsc guarantee to typed receivers
Summary
Array.prototype.toSorted/toReversed(ES2023) require Safari 16+ / iOS 16+ and Next.js/SWC does not polyfill prototype methods (vercel/next.js#58421 was closed unmerged per maintainer policy). So the react-doctor pass in improvement(landing): react-doctor health pass across the landing surface #5326 introduced a runtimeTypeError: … toSorted is not a functionon Safari 15 / iOS 15 — breaking sorting on the models page and the landing preview (logs/resource) plus the lifecycle monitor icon.[...arr].sort()/[...arr].reverse()— immutable (copies first), universally supported, and matching the existing codebase idiom (8 other[...x].sort()sites)."lib": ["ES2023", …]override inapps/sim/tsconfig.jsonthat only existed to type-checktoSorted; back on the inherited ES2022 lib, these methods no longer type-check, restoring the guardrail against re-introduction.toSorted/toReversed/toSplicedusages — the issue exists nowhere else.Type of Change
Testing
tsc --noEmitclean on the ES2022 baseline (0 errors),biome checkclean,bun run lintclean. Verified no remaining ES2023 array-method usages repo-wide. Browser support + Next.js no-polyfill behavior validated against caniuse and the Next.js issue/PR threads.Checklist