fix(app): add null coalescing to localeCompare sort operations
Prevents TypeError when sorting items with undefined/null values. Applies defensive programming pattern across web UI and console.
Fixes #6391
I think I already addressed these, can you check @leprachuan ?
@adamdotdevin thanks for taking a look and sorry for my tardiness, were past the holidays and work has started back up. I checked in the most recent dev branch and I don't see any null coalescing protections against localCompares. You might have addressed the situations where async resulted in the value still being null and not a string when the localCompare is attempted. However, I still believe it would be of value have a default value in the event the string is null to avoid UI crashes.
Examples of where we should probably put a check from the current dev branch :)
Components:
-
packages/app/src/components/dialog-manage-models.tsx:18 -
packages/app/src/components/dialog-select-mcp.tsx:16,44 -
packages/app/src/components/dialog-select-model-unpaid.tsx:74 -
packages/app/src/components/dialog-select-model.tsx:36 -
packages/app/src/components/dialog-select-provider.tsx:27
Context:
-
packages/app/src/context/global-sync.tsx:170,274,306,598 -
packages/app/src/context/sync.tsx:60,73,131,234
Pages:
-
packages/app/src/pages/layout.tsx:376,567,580
Console:
-
packages/console/app/src/routes/workspace/[id]/model-section.tsx:51
essentially, anytime the expected string object in any of these calls is not already set prior to the compare the UI will crash :)
Perhaps this is covered by protections in the data flow that garuntees that these values are never null or unset at the time of compare, if so feel free to decline the PR, however thats extremely hard to garuntee :)