When there are multiple pages in the knowledge base, an error is returned after entering the segment list #5787

Closed
opened 2026-02-21 18:12:35 -05:00 by yindo · 2 comments
Owner

Originally created by @deific on GitHub (Sep 24, 2024).

Originally assigned to: @crazywoola on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.8.3

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

When there are multiple pages in the knowledge base, an error is returned after entering the segment list
1、There are multiple pages and the third page has been redirected
image
2、entering the segment list of one document
image
3、When returning, it did not return to the third page before entering, but directly returned to the first page
image

✔️ Expected Behavior

Return to the page where you enter the segmented list of the document

Actual Behavior

Fixed return to page 1

Originally created by @deific on GitHub (Sep 24, 2024). Originally assigned to: @crazywoola on GitHub. ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.8.3 ### Cloud or Self Hosted Cloud, Self Hosted (Docker) ### Steps to reproduce When there are multiple pages in the knowledge base, an error is returned after entering the segment list 1、There are multiple pages and the third page has been redirected ![image](https://github.com/user-attachments/assets/1fccdd9f-eb90-48bc-bd25-b5b900c883fc) 2、entering the segment list of one document ![image](https://github.com/user-attachments/assets/dbbcf14f-5716-4450-8801-6b9366a37c99) 3、When returning, it did not return to the third page before entering, but directly returned to the first page ![image](https://github.com/user-attachments/assets/55c400d0-97e6-48ad-90ff-70b8b78b35cc) ### ✔️ Expected Behavior Return to the page where you enter the segmented list of the document ### ❌ Actual Behavior Fixed return to page 1
yindo added the 🐞 bug label 2026-02-21 18:12:35 -05:00
yindo closed this issue 2026-02-21 18:12:35 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 24, 2024):

I found a similar open issue titled correct back button on documents, which is closed and was last updated on September 12, 2024. The issue has no comments or solution [1].

The 'back' button functionality in the segment list view is implemented using the backToPrev function, which navigates the user back to the document list view. This function is triggered by clicking on a div containing the ArrowLeftIcon [2].

Here is the relevant code:

const backToPrev = () => {
  router.push(`/datasets/${datasetId}/documents`)
}

// ...

<div onClick={backToPrev} className={'shrink-0 rounded-full w-8 h-8 flex justify-center items-center border-gray-100 cursor-pointer border hover:border-gray-300 shadow-[0px_12px_16px_-4px_rgba(16,24,40,0.08),0px_4px_6px_-2px_rgba(16,24,40,0.03)]'}>
  <ArrowLeftIcon className='text-primary-600 fill-current stroke-current h-4 w-4' />
</div>

It seems that the current implementation does not store the page number before navigating to the segment list, causing it to return to the first page by default. There is no state or context management in place to store the current page number when navigating between different views in the knowledge base [2].

To address this issue, you might consider implementing a state management solution (e.g., using React's Context API or a global state management library like Redux) to persist the current page state across different components. This way, you can ensure that the user returns to the correct page after navigating back from the segment list.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 24, 2024): <!-- Answer --> I found a similar open issue titled [correct back button on documents](https://github.com/langgenius/dify/issues/4166), which is closed and was last updated on September 12, 2024. The issue has no comments or solution <sup>[[1]](https://github.com/langgenius/dify/issues/4166)</sup>. The 'back' button functionality in the segment list view is implemented using the `backToPrev` function, which navigates the user back to the document list view. This function is triggered by clicking on a div containing the `ArrowLeftIcon` <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/components/datasets/documents/detail/index.tsx)</sup>. Here is the relevant code: ```tsx const backToPrev = () => { router.push(`/datasets/${datasetId}/documents`) } // ... <div onClick={backToPrev} className={'shrink-0 rounded-full w-8 h-8 flex justify-center items-center border-gray-100 cursor-pointer border hover:border-gray-300 shadow-[0px_12px_16px_-4px_rgba(16,24,40,0.08),0px_4px_6px_-2px_rgba(16,24,40,0.03)]'}> <ArrowLeftIcon className='text-primary-600 fill-current stroke-current h-4 w-4' /> </div> ``` It seems that the current implementation does not store the page number before navigating to the segment list, causing it to return to the first page by default. There is no state or context management in place to store the current page number when navigating between different views in the knowledge base <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/app/components/datasets/documents/detail/index.tsx)</sup>. To address this issue, you might consider implementing a state management solution (e.g., using React's Context API or a global state management library like Redux) to persist the current page state across different components. This way, you can ensure that the user returns to the correct page after navigating back from the segment list. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Sep 25, 2024):

Thanks for the feedback, however we do not have much time on refining this part, we will take a look at this later.

@crazywoola commented on GitHub (Sep 25, 2024): Thanks for the feedback, however we do not have much time on refining this part, we will take a look at this later.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5787