mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 06:37:33 +00:00
fix(tours): sorts that name their order, the note focused without autofocus
The checklist and the obstacle data sorted texts without a compare function. They now sort by code units through one shared compareCodeUnits, the order a bare sort gave, the same on every machine; the material data of a lock's parts no longer orders by the server's locale, so its hash cannot change with it. The note editor takes the focus through a ref instead of autoFocus, a direct function reference in a map becomes a call, and the GPX import's default fields are a named constant.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Two texts by their UTF-16 code units: the order a bare `sort()` gives, and
|
||||
* the same on every machine. A hash or a key built over the order must not
|
||||
* depend on the locale the code runs in, as `localeCompare` does.
|
||||
*/
|
||||
export function compareCodeUnits(a: string, b: string): number {
|
||||
if (a === b) return 0;
|
||||
return a < b ? -1 : 1;
|
||||
}
|
||||
Reference in New Issue
Block a user