A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: #943
haitao(lj)bb8f0647a6b3
diff --git a/ui/src/components/Pagination/index.tsx b/ui/src/components/Pagination/index.tsxindex 7e4169d0..2ae10b35 100644--- a/ui/src/components/Pagination/index.tsx+++ b/ui/src/components/Pagination/index.tsx@@ -1,12 +1,13 @@import { FC, memo } from 'react';import { Pagination } from 'react-bootstrap';import { useTranslation } from 'react-i18next';-import { useSearchParams, useNavigate } from 'react-router-dom';+import { useSearchParams, useNavigate, useLocation } from 'react-router-dom';interface Props {currentPage: number;pageSize: number;totalSize: number;+ pathname?: string;}interface PageItemProps {@@ -58,9 +59,13 @@ const Index: FC<Props> = ({currentPage = 1,pageSize = 15,totalSize = 0,+ pathname = '',}) => {const { t } = useTranslation('translation', { keyPrefix: 'pagination' });-+ const location = useLocation();+ if (!pathname) {+ pathname = location.pathname;+ }const [searchParams] = useSearchParams();const navigate = useNavigate();const totalPage = Math.ceil(totalSize / pageSize);@@ -73,10 +78,9 @@ const Index: FC<Props> = ({}const handleParams = (pageNum): string => {- const basePath = window.location.pathname;searchParams.set('page', String(pageNum));const searchStr = searchParams.toString();- return `${basePath}?${searchStr}`;+ return `${pathname}?${searchStr}`;};return (<Pagination size="sm" className="d-inline-flex mb-0">diff --git a/ui/src/components/Questions/index.tsx b/ui/src/components/Questions/index.tsxindex 07853768..200ede4c 100644--- a/ui/src/components/Questions/index.tsx+++ b/ui/src/components/Questions/index.tsx@@ -187,6 +187,7 @@ const QuestionList: FC<Props> = ({ source }) => {currentPage={curPage}totalSize={count}pageSize={pageSize}+ pathname="/questions"/></div></div>