fix(scroll): Set scroll position for Question detail

This commit is contained in:
haitao(lj) 2023-01-09 17:43:05 +08:00
parent 5617a4eb0e
commit a4f69d24d5
2 changed files with 4 additions and 4 deletions

View File

@ -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();
});
},
});

View File

@ -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]);