fix(notifications): sort by newest first by default [EE-4467] (#7891)

pull/7812/head^2
itsconquest 2 years ago committed by GitHub
parent 58947fee69
commit c1f94be9b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,10 +24,11 @@ export interface SortableTableSettings {
export function sortableSettings(
set: Set<SortableTableSettings>,
initialSortBy = 'name'
initialSortBy = 'name',
desc = false
): SortableTableSettings {
return {
sortBy: { id: initialSortBy, desc: false },
sortBy: { id: initialSortBy, desc },
setSortBy: (id: string, desc: boolean) => set({ sortBy: { id, desc } }),
};
}

@ -18,7 +18,7 @@ import { columns } from './columns';
import { createStore } from './datatable-store';
const storageKey = 'notifications-list';
const useSettingsStore = createStore(storageKey, 'time');
const useSettingsStore = createStore(storageKey, 'time', true);
export function NotificationsView() {
const settingsStore = useSettingsStore();

@ -19,11 +19,15 @@ interface TableSettings
SettableColumnsTableSettings,
RefreshableTableSettings {}
export function createStore(storageKey: string, initialSortBy?: string) {
export function createStore(
storageKey: string,
initialSortBy?: string,
desc?: boolean
) {
return create<TableSettings>()(
persist(
(set) => ({
...sortableSettings(set, initialSortBy),
...sortableSettings(set, initialSortBy, desc),
...paginationSettings(set),
...hiddenColumnsSettings(set),
...refreshableSettings(set),

Loading…
Cancel
Save