Skip to content
Snippets Groups Projects
Unverified Commit 185daf47 authored by Sean Tsai's avatar Sean Tsai Committed by GitHub
Browse files

Sort saved filters by alphabetical order (#1298)

fix #1284
parent 723cbcf9
No related branches found
No related tags found
No related merge requests found
import { useMemo } from 'react';
import q from '../query-helpers';
import { useLiveQuery } from '../query-hooks';
......@@ -16,7 +18,16 @@ function toJS(rows) {
}
export function useFilters() {
return toJS(
const filters = toJS(
useLiveQuery(() => q('transaction_filters').select('*'), []) || [],
);
/** Sort filters by alphabetical order */
function sort(filters) {
return filters.sort((a, b) =>
a.name.trim().localeCompare(b.name.trim(), { ignorePunctuation: true }),
);
}
return useMemo(() => sort(filters), [filters]);
}
---
category: Maintenance
authors: [aleetsaiya]
---
Sort saved filters by alphabetical order
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment