Skip to content

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(scroll): Set scroll position for Question detail

haitao(lj)a4f69d24d56d
diff --git a/ui/src/components/Operate/index.tsx b/ui/src/components/Operate/index.tsx
index 1dfa3f46..a711d8ed 100644
--- a/ui/src/components/Operate/index.tsx
+++ b/ui/src/components/Operate/index.tsx
@@ -41,10 +41,10 @@ const Index: FC<IProps> = ({
const navigate = useNavigate();
const reportModal = useReportModal();
- const refershQuestion = () => {
+ const refreshQuestion = () => {
callback?.('default');
};
- const closeModal = useReportModal(refershQuestion);
+ const closeModal = useReportModal(refreshQuestion);
const editUrl =
type === 'answer' ? `/posts/${qid}/${aid}/edit` : `/posts/${qid}/edit`;
@@ -132,7 +132,7 @@ const Index: FC<IProps> = ({
msg: t('success', { keyPrefix: 'question_detail.reopen' }),
variant: 'success',
});
- refershQuestion();
+ refreshQuestion();
});
},
});
diff --git a/ui/src/pages/Questions/Detail/index.tsx b/ui/src/pages/Questions/Detail/index.tsx
index 2b9a121f..436b1dd3 100644
--- a/ui/src/pages/Questions/Detail/index.tsx
+++ b/ui/src/pages/Questions/Detail/index.tsx
@@ -123,7 +123,6 @@ const Index = () => {
}, 1000);
return;
}
-
if (type === 'default') {
window.scrollTo(0, 0);
getDetail();
@@ -150,6 +149,7 @@ const Index = () => {
if (!qid) {
return;
}
+ window.scrollTo(0, 0);
getDetail();
requestAnswers();
}, [qid]);