Skip to content

Commit 1843922

Browse files
committed
Use canonical keys
1 parent 412c2a7 commit 1843922

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/js/performance.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,15 @@ export class FilterCache {
463463
* Generate cache key from filter values
464464
*/
465465
generateKey(filters) {
466-
// Create a stable string representation of filters
467-
return JSON.stringify(filters, Object.keys(filters).sort());
466+
// Build a canonical object: keys sorted alphabetically, array values sorted
467+
// so that logically identical filters always produce the same key regardless
468+
// of insertion order or multi-select ordering.
469+
const sorted = {};
470+
for (const key of Object.keys(filters).sort()) {
471+
const val = filters[key];
472+
sorted[key] = Array.isArray(val) ? [...val].sort() : val;
473+
}
474+
return JSON.stringify(sorted);
468475
}
469476

470477
/**

0 commit comments

Comments
 (0)