UI: restore control page compatibility without toSorted#31588
UI: restore control page compatibility without toSorted#31588liuxiaopai-ai wants to merge 4 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d21de3c1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ui/src/ui/app-render.ts
Outdated
| // Keep compat with older Chromium versions (for example legacy Windows 7 builds) | ||
| // where Array.prototype.toSorted is unavailable. |
There was a problem hiding this comment.
Remove unsupported toSorted from legacy-compatible render path
This change adds a compatibility note for older Chromium, but the same render path still calls toSorted for both cron suggestion arrays, so browsers without Array.prototype.toSorted will continue to throw at runtime and render a blank control UI. In other words, the commit introduces a misleading guardrail comment without the functional fallback, which can hide that #30467 is still unfixed.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR claims to fix compatibility with older Chromium builds by replacing Critical issues:
The fix is straightforward: replace Confidence Score: 0/5
Last reviewed commit: d97bde1 |
Additional Comments (2)
Prompt To Fix With AIThis is a comment left during a code review.
Path: ui/src/ui/app-render.ts
Line: 180
Comment:
`.toSorted()` not replaced - still using incompatible method despite compatibility comment above. Should be `.sort((a, b) => a.localeCompare(b))` (works because `Array.from(new Set(...))` already creates a new array)
```suggestion
).sort((a, b) => a.localeCompare(b));
```
How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix With AIThis is a comment left during a code review.
Path: ui/src/ui/app-render.ts
Line: 196
Comment:
`.toSorted()` not replaced here either - same compatibility issue. Should be `.sort((a, b) => a.localeCompare(b))`
```suggestion
).sort((a, b) => a.localeCompare(b));
```
How can I resolve this? If you propose a fix, please make it concise. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed149499cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ui/src/ui/app-render.ts
Outdated
| if (typeof maybeToSorted === "function") { | ||
| return maybeToSorted.call(entries, (a, b) => a.localeCompare(b)); | ||
| } | ||
| return entries.slice().toSorted((a, b) => a.localeCompare(b)); |
There was a problem hiding this comment.
Use
sort in legacy fallback path
Fresh evidence in this commit: the new sortStringsCompat helper still calls toSorted in its fallback branch, so environments that lack Array.prototype.toSorted (the exact compatibility target) will still throw TypeError when rendering cron suggestions and the control page remains broken there. The fallback should avoid toSorted entirely (for example by sorting a copied array with sort).
Useful? React with 👍 / 👎.
|
Thanks for the earlier contribution. I'm going to close this as a duplicate of #31775. If this is a mistake, tell me and I can reopen review right away. |
Summary
Describe the problem and fix in 2–5 bullets:
Array.prototype.toSorted, which is missing in older Chromium builds and caused runtimeTypeError+ blank page.toSorted(...)with equivalentArray.from(...).sort(...)usage for cron suggestion lists inapp-render.ts, plus an inline compatibility note.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Array.prototype.toSortedsupport in this render path.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
ui/src/ui/app-render.ts.toSortedusage remains in this render path and comparator behavior is unchanged.Expected
toSorted.Actual
sorton fresh arrays created fromArray.from(...), preserving behavior while removing runtime dependency.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
5d21de3c1.ui/src/ui/app-render.ts.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.Array.from(new Set(...))arrays and includes compatibility comment to guard intent.