mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 18:00:17 +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 formattedValues = useMemo(() => {
|
||||||
const formatted = {};
|
const formatted = {};
|
||||||
const { compare } = new Intl.Collator(locale, { numeric: true });
|
|
||||||
const format = val => {
|
const format = val => {
|
||||||
formatted[val] = formatValue(val, name);
|
formatted[val] = formatValue(val, name);
|
||||||
return formatted[val];
|
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;
|
return formatted;
|
||||||
}, [values]);
|
}, [values]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user