Prevent redirect to topic details before topic create/update response arrives.

This commit is contained in:
Sofia Shnaidman 2020-11-09 11:20:17 +03:00
parent 88cc301bb6
commit 6673bd53c4
2 changed files with 3 additions and 4 deletions

View file

@ -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 (

View file

@ -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 (