You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raw >/< on unnormalized strings — SharedUsersLists
Plus alphaEmailSort copy-pasted verbatim into OrganizationMemberList and OrganizationGuestList.
Changes
helpers/utilHelper.ts gains one shared comparator pair backed by a single Intl.Collator:
alphaSort(a, b) — for strings (emails, nodeName, nested fields)
byName(a, b) — for the common { name } object case, so most call sites become .sort(byName)
Every site above now routes through it, and the two private nameSorts plus both alphaEmailSort copies are deleted. Net -38/+43 lines across 15 files.
Behavior changes
This deliberately makes previously-inconsistent sorts agree, so some orderings shift:
numeric: true everywhere — device2 now sorts before device10 instead of after. This is the main visible change and the reason for the collator.
sensitivity: 'base' — case and accents no longer split otherwise-equal names. The toLowerCase() sites were already effectively case-insensitive; the bare-localeCompare sites (tags, device selection) change.
Two-way comparators now return 0 on equal.OrganizationSelect, OrganizationSelectList, FilterDrawer, and NetworksPage used ? 1 : -1, which never returns 0 and gives an unstable order for equal names. They're now stable.
SortServices ZTOA is byName(b, a) rather than a separately hand-written reversed comparator.
Testing
tsc --noEmit passes. Verified by grep that no localeCompare, toLowerCase() comparison, or raw name/email comparator remains in frontend/src. Not exercised in the running app — the sorts are visual, so a click through tags, networks, org member lists, and the service sort menu is worth doing before merge.
Synchronize selections when the device sort changes
If the user selects multiple devices and then changes the sort in FilterDrawer, the fetched visibleDevices reorder but sortSelectedIds is not called because no selection click occurs, so state.ui.selected retains the previous order. ScriptRunPage maps selectedIds directly into resolvedDevices and submits that same array as form.deviceIds, meaning the displayed and submitted device order no longer matches the list sort this change promises to follow; derive the ordered selection when the list order changes rather than only inside handleSelect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1167 — review that one first. GitHub will retarget this to
mainautomatically when #1167 merges."Alphabetical" meant four different things across the UI. There were ~14 hand-rolled comparators in 12 files, in four flavors:
localeCompare(case-sensitive) —Tags,selectedHelper,selectors/tagslocaleComparewith{ sensitivity: 'base' }—selectors/contactstoLowerCase()with</>—connections,search,SortServices,FilterDrawer,OrganizationSelect,OrganizationSelectList,NetworksPage>/<on unnormalized strings —SharedUsersListsPlus
alphaEmailSortcopy-pasted verbatim intoOrganizationMemberListandOrganizationGuestList.Changes
helpers/utilHelper.tsgains one shared comparator pair backed by a singleIntl.Collator:alphaSort(a, b)— for strings (emails,nodeName, nested fields)byName(a, b)— for the common{ name }object case, so most call sites become.sort(byName)Every site above now routes through it, and the two private
nameSorts plus bothalphaEmailSortcopies are deleted. Net -38/+43 lines across 15 files.Behavior changes
This deliberately makes previously-inconsistent sorts agree, so some orderings shift:
numeric: trueeverywhere —device2now sorts beforedevice10instead of after. This is the main visible change and the reason for the collator.sensitivity: 'base'— case and accents no longer split otherwise-equal names. ThetoLowerCase()sites were already effectively case-insensitive; the bare-localeComparesites (tags, device selection) change.OrganizationSelect,OrganizationSelectList,FilterDrawer, andNetworksPageused? 1 : -1, which never returns 0 and gives an unstable order for equal names. They're now stable.SortServicesZTOA isbyName(b, a)rather than a separately hand-written reversed comparator.Testing
tsc --noEmitpasses. Verified by grep that nolocaleCompare,toLowerCase()comparison, or raw name/email comparator remains infrontend/src. Not exercised in the running app — the sorts are visual, so a click through tags, networks, org member lists, and the service sort menu is worth doing before merge.