mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-25 10:41:31 +03:00
fix: sort in desc based update date by default (#2510)
This commit is contained in:
parent
675c737e48
commit
be065e2de3
@ -117,7 +117,7 @@ export const PageList = ({
|
||||
}: PageListProps) => {
|
||||
const sorter = useSorter<ListData>({
|
||||
data: list,
|
||||
key: 'createDate',
|
||||
key: 'updatedDate',
|
||||
order: 'desc',
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@ type SorterConfig<T> = {
|
||||
const defaultSortingFn = <T extends Record<keyof any, unknown>>(
|
||||
ctx: {
|
||||
key: keyof T;
|
||||
order: 'asc' | 'desc' | 'none';
|
||||
order: 'asc' | 'desc';
|
||||
},
|
||||
a: T,
|
||||
b: T
|
||||
@ -21,10 +21,10 @@ const defaultSortingFn = <T extends Record<keyof any, unknown>>(
|
||||
return 0;
|
||||
}
|
||||
if (typeof valA === 'string') {
|
||||
return valA.localeCompare(valB as string) * (revert ? 1 : -1);
|
||||
return valA.localeCompare(valB as string) * (revert ? -1 : 1);
|
||||
}
|
||||
if (typeof valA === 'number') {
|
||||
return valA - (valB as number) * (revert ? 1 : -1);
|
||||
return valA - (valB as number) * (revert ? -1 : 1);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user