mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 03:32:54 -05:00
@@ -1,3 +1,5 @@
|
||||
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]);
|
||||
}
|
||||
|
||||
5
upcoming-release-notes/1298.md
Normal file
5
upcoming-release-notes/1298.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [aleetsaiya]
|
||||
---
|
||||
Sort saved filters by alphabetical order
|
||||
Reference in New Issue
Block a user