1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-28 23:16:32 -04:00

Fix changing sort direction

This commit is contained in:
Mark McDowall
2025-11-15 11:49:59 -08:00
parent 21592f3d69
commit aac4760d30
13 changed files with 133 additions and 38 deletions
+11 -3
View File
@@ -14,6 +14,7 @@ import TableBody from 'Components/Table/TableBody';
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
import TablePager from 'Components/Table/TablePager';
import { align, icons, kinds } from 'Helpers/Props';
import { SortDirection } from 'Helpers/Props/sortDirections';
import { executeCommand } from 'Store/Actions/commandActions';
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
import { TableOptionsChangePayload } from 'typings/Table';
@@ -21,6 +22,7 @@ import translate from 'Utilities/String/translate';
import {
setEventOption,
setEventOptions,
setEventSort,
useEventOptions,
} from './eventOptionsStore';
import LogsTableRow from './LogsTableRow';
@@ -56,9 +58,15 @@ function LogsTable() {
[]
);
const handleSortPress = useCallback((sortKey: string) => {
setEventOption('sortKey', sortKey);
}, []);
const handleSortPress = useCallback(
(sortKey: string, sortDirection?: SortDirection) => {
setEventSort({
sortKey,
sortDirection,
});
},
[]
);
const handleTableOptionChange = useCallback(
(payload: TableOptionsChangePayload) => {
@@ -6,9 +6,8 @@ import translate from 'Utilities/String/translate';
export type EventOptions = PageableOptions;
const { useOptions, setOptions, setOption } = createOptionsStore<EventOptions>(
'event_options',
() => {
const { useOptions, setOptions, setOption, setSort } =
createOptionsStore<EventOptions>('event_options', () => {
return {
pageSize: 50,
selectedFilterKey: 'all',
@@ -52,9 +51,9 @@ const { useOptions, setOptions, setOption } = createOptionsStore<EventOptions>(
},
],
};
}
);
});
export const useEventOptions = useOptions;
export const setEventOptions = setOptions;
export const setEventOption = setOption;
export const setEventSort = setSort;