-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix: Fix the issue where the original page number was not preserved when returning to the knowledge base dataset file list after viewing file details. #5199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…hen returning to the knowledge base dataset file list after viewing file details.
TestGru AssignmentSummary
Tip You can |
sweeney seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
1 similar comment
sweeney seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Preview sandbox Image:
|
Preview mcp_server Image:
|
Preview fastgpt Image:
|
@@ -55,7 +57,7 @@ export function usePagination<DataT, ResT = {}>( | |||
|
|||
const fetchData = useMemoizedFn( | |||
async (num: number = pageNum, ScrollContainerRef?: RefObject<HTMLDivElement>) => { | |||
if (noMore && num !== 1) return; | |||
if (noMore && num !== defaultPageNum) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这边是不需要调整的,只需要 defaultPageNum 赋值到 useState 里即可
@@ -16,6 +16,8 @@ import { type WebsiteConfigFormType } from './WebsiteConfig'; | |||
|
|||
const WebSiteConfigModal = dynamic(() => import('./WebsiteConfig')); | |||
|
|||
let defaultPageNum = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在外层的变量似乎是全局生效的,这么写会导致一个问题:
- 切换到第 2 页集合。
- 退出知识库
- 再进入知识库
可能会导致默认就是第二页了。
我觉得应该把 pageNum 写在 router query 里更好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者写在 datasetContext 这个更大的上下文里
好的,感谢,我再看看 |
if (noMore && num !== defaultPageNum) return;
async () => {
defaultRequest && fetchData(defaultPageNum);
}, 需要说明的是以上两处修改经过测试是有必要的,返回通用触发了刷新。 |
@c121914yu 辛苦看看。 |
非第一页,返回就是需要触发刷新,这应该符合预期 |
之前这两处的defaultPageNum都写的1,如果不改成defaultPageNum还是都会返回第一页。 |
noMore && num !== defaultPageNum 不需要改,这个含义是第一页不管有没有更多数据,都会强制加载。 defaultRequest && fetchData(defaultPageNum) 改的话也会有问题,因为依赖刷新的话,应该就是要到 第一页(比如一些过滤条件刷新了,你可以测试下输入搜索词,这样改就不会跳回第一页了) |
#5067
Fix the issue where the original page number was not preserved when returning to the knowledge base dataset file list after viewing file details.
(修复查看知识库数据集文件详情后返回列表时未保留原页码的问题)