feat: jumping from the chunk list page to the file list page keeps th… (#174)
* feat: jumping from the chunk list page to the file list page keeps the original page number. * feat: jump to the file upload page and reset the file list page number to 1
This commit is contained in:
@@ -74,7 +74,7 @@ export const useGetPagination = (fetchDocumentList: () => void) => {
|
||||
showQuickJumper: true,
|
||||
total: kFModel.total,
|
||||
showSizeChanger: true,
|
||||
current: kFModel.pagination.currentPage,
|
||||
current: kFModel.pagination.current,
|
||||
pageSize: kFModel.pagination.pageSize,
|
||||
pageSizeOptions: [1, 2, 10, 20, 50, 100],
|
||||
onChange: onPageChange,
|
||||
|
||||
@@ -223,5 +223,24 @@ const model: DvaModel<KFModelState> = {
|
||||
return data;
|
||||
},
|
||||
},
|
||||
subscriptions: {
|
||||
setup({ dispatch, history }) {
|
||||
history.listen(({ location }) => {
|
||||
const state: { from: string } = (location.state ?? {
|
||||
from: '',
|
||||
}) as { from: string };
|
||||
if (
|
||||
state.from === '/knowledge' || // TODO: Just directly determine whether the current page is on the knowledge list page.
|
||||
location.pathname === '/knowledge/dataset/upload'
|
||||
) {
|
||||
dispatch({
|
||||
type: 'kFModel/setPagination',
|
||||
payload: { current: 1, pageSize: 10 },
|
||||
});
|
||||
}
|
||||
console.info(location);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
export default model;
|
||||
|
||||
Reference in New Issue
Block a user