mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 01:46:58 +01:00
fix single filter value
This commit is contained in:
parent
d5eddeae24
commit
f016970186
@ -21,12 +21,16 @@ export default function FieldFilterForm({
|
||||
|
||||
const formattedValues = useMemo(() => {
|
||||
const formatted = {};
|
||||
const { compare } = new Intl.Collator(locale, { numeric: true });
|
||||
const format = val => {
|
||||
formatted[val] = formatValue(val, name);
|
||||
return formatted[val];
|
||||
};
|
||||
values.sort((a, b) => compare(formatted[a] ?? format(a), formatted[b] ?? format(b)));
|
||||
if (values.length !== 1) {
|
||||
const { compare } = new Intl.Collator(locale, { numeric: true });
|
||||
values.sort((a, b) => compare(formatted[a] ?? format(a), formatted[b] ?? format(b)));
|
||||
} else {
|
||||
format(values[0]);
|
||||
}
|
||||
return formatted;
|
||||
}, [values]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user