Fix inconsistent search behavior on counter click codes

This commit is contained in:
Antoine Bartuccio 2025-01-09 01:04:11 +01:00
parent cca486f2b9
commit 9f33ddd883

View File

@ -76,7 +76,15 @@ export class CounterProductSelect extends AutoCompleteSelectBase {
return {
...super.tomSelectSettings(),
openOnFocus: false,
searchField: ["code", "text"],
// We make searching on exact code matching a higher priority
// We need to manually set weights or it results on an inconsistent
// behavior between production and development environment
searchField: [
// @ts-ignore documentation says it's fine, specified type is wrong
{ field: "code", weight: 2 },
// @ts-ignore documentation says it's fine, specified type is wrong
{ field: "text", weight: 0.5 },
],
};
}
}