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: when using the basic_captacha plug-in, usePromptWithUnload hook causes logic exceptions when asking or editing questions

shuai58970d0abb34
diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsx
index 30939a2e..1bc92cc7 100644
--- a/ui/src/pages/Questions/Ask/index.tsx
+++ b/ui/src/pages/Questions/Ask/index.tsx
@@ -283,6 +283,7 @@ const Ask = () => {
};
const submitModifyQuestion = (params) => {
+ setBlockState(false);
const ep = {
...params,
id: qid,
@@ -312,6 +313,7 @@ const Ask = () => {
};
const submitQuestion = async (params) => {
+ setBlockState(false);
const imgCode = saveCaptcha?.getCaptcha();
if (imgCode?.verify) {
params.captcha_code = imgCode.captcha_code;
@@ -371,16 +373,12 @@ const Ask = () => {
if (isEdit) {
if (!editCaptcha) {
- setBlockState(false);
submitModifyQuestion(params);
return;
}
- editCaptcha.check(() => {
- submitModifyQuestion(params);
- });
+ editCaptcha.check(() => submitModifyQuestion(params));
} else {
if (!saveCaptcha) {
- setBlockState(false);
submitQuestion(params);
return;
}
diff --git a/ui/src/pages/Questions/index.tsx b/ui/src/pages/Questions/index.tsx
index f1b26c18..e0bf27ff 100644
--- a/ui/src/pages/Questions/index.tsx
+++ b/ui/src/pages/Questions/index.tsx
@@ -53,7 +53,7 @@ const Questions: FC = () => {
Storage.set(QUESTIONS_ORDER_STORAGE_KEY, curOrder);
}
const reqParams: Type.QueryQuestionsReq = {
- page_size: 10,
+ page_size: 20,
page: curPage,
order: curOrder as Type.QuestionOrderBy,
};