fix: preserve pagination and filters across list navigation
douyin-release-gate / verify (push) Failing after 18m33s

This commit is contained in:
2026-10-07 14:41:11 +08:00
parent 718e4479cf
commit 51091cf0c5
21 changed files with 565 additions and 46 deletions
+12
View File
@@ -3,6 +3,7 @@
import { ProProvider, RouteContext } from '@ant-design/pro-components';
import type { ColumnsType, ColumnType } from 'antd/es/table';
import { useContext } from 'react';
import { usePageState } from '@/hooks/usePageState';
export const TABLE_PAGE_SIZE = 20;
@@ -18,6 +19,17 @@ export function tablePagination() {
return { pageSize: TABLE_PAGE_SIZE, hideOnSinglePage: true };
}
export function useTablePagination() {
const [pagination, setPagination] = usePageState('pagination', { current: 1, pageSize: TABLE_PAGE_SIZE });
return {
...tablePagination(),
...pagination,
onChange: (current: number, pageSize: number) => {
setPagination(previous => ({ current: pageSize === previous.pageSize ? current : 1, pageSize }));
},
};
}
export function fixedLeft<RecordType>(column: ColumnType<RecordType>): ColumnType<RecordType> {
return { ...column, fixed: 'left' as const };
}