소스 검색

Merge pull request #113 from provectus/bugfix/topic-create-update-callback

Prevent redirect to topic details before topic create/update response arrives.
soffest 4 년 전
부모
커밋
15c818fa70
2개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      kafka-ui-react-app/src/components/Topics/Edit/Edit.tsx
  2. 2 3
      kafka-ui-react-app/src/components/Topics/New/New.tsx

+ 1 - 1
kafka-ui-react-app/src/components/Topics/Edit/Edit.tsx

@@ -110,8 +110,8 @@ const Edit: React.FC<Props> = ({
   });
 
   const onSubmit = async (data: TopicFormData) => {
-    setIsSubmitting(true);
     updateTopic(clusterName, data);
+    setIsSubmitting(true); // Keep this action after updateTopic to prevent redirect before update.
   };
 
   return (

+ 2 - 3
kafka-ui-react-app/src/components/Topics/New/New.tsx

@@ -34,10 +34,9 @@ const New: React.FC<Props> = ({
   const onSubmit = async (data: TopicFormData) => {
     // TODO: need to fix loader. After success loading the first time, we won't wait for creation any more, because state is
     // loaded, and we will try to get entity immediately after pressing the button, and we will receive null
-    // going to object page on the second creation. Resetting loaded state is workaround, need to tweak loader logic
-    resetUploadedState();
-    setIsSubmitting(true);
+    // going to object page on the second creation. Setting of isSubmitting after createTopic is a workaround, need to tweak loader logic
     createTopic(clusterName, data);
+    setIsSubmitting(true); // Keep this action after createTopic to prevent redirect before create.
   };
 
   return (