fix(web): enhance security for external links and improve pagination

This commit is contained in:
CodingOnStar 2026-01-13 15:09:08 +08:00
parent 532073175a
commit b56777914d
2 changed files with 4 additions and 3 deletions

View File

@ -120,6 +120,7 @@ const DocumentsHeader: FC<DocumentsHeaderProps> = ({
<a
className="flex items-center text-text-accent"
target="_blank"
rel="noopener noreferrer"
href={docLink('/guides/knowledge-base/integrate-knowledge-within-application')}
>
<span>{t('list.learnMore', { ns: 'datasetDocuments' })}</span>

View File

@ -158,9 +158,9 @@ export function useDocumentsPageState() {
if (!documentsRes)
return
const totalPages = Math.ceil(documentsRes.total / limit)
if (totalPages < currPage + 1)
setCurrPage(totalPages === 0 ? 0 : totalPages - 1)
}, [limit, currPage])
if (currPage > 0 && currPage + 1 > totalPages)
handlePageChange(totalPages > 0 ? totalPages - 1 : 0)
}, [limit, currPage, handlePageChange])
return {
// Search state