You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/05/09 02:50:29 UTC

(incubator-answer) 03/03: fix: when using the basic_captacha plug-in, usePromptWithUnload hook causes logic exceptions when asking or editing questions

This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch release/1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit 67b3eed531a0a7385296f4824937a496ecd80cf9
Author: shuai <li...@sifou.com>
AuthorDate: Thu May 9 10:48:17 2024 +0800

    fix: when using the basic_captacha plug-in, usePromptWithUnload hook causes logic exceptions when asking or editing questions
---
 ui/src/pages/Questions/Ask/index.tsx | 8 +++-----
 ui/src/pages/Questions/index.tsx     | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

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,
   };