mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 22:16:26 +00:00
fix(ski-routing): sort the network cache key by code unit, not by default
This commit is contained in:
@@ -56,7 +56,8 @@ export class NetCache {
|
||||
constructor(private readonly budget = NETWORK_BUDGET_BYTES) {}
|
||||
|
||||
get(files: readonly string[]): Promise<SkiRouter> {
|
||||
const key = [...files].sort().join('|');
|
||||
// Code unit order, so the key never depends on a locale.
|
||||
const key = [...files].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)).join('|');
|
||||
const known = this.routers.get(key);
|
||||
if (known) {
|
||||
this.routers.delete(key);
|
||||
|
||||
Reference in New Issue
Block a user