Просмотр исходного кода

prevent api call to be made if component is not mounted

jnfrati 4 лет назад
Родитель
Сommit
267ab41c32

+ 3 - 0
dashboard/src/main/home/onboarding/steps/ProvisionResources/forms/StatusPage.tsx

@@ -147,6 +147,9 @@ export const StatusPage = ({
   };
 
   const getDesiredState = async (infra_id: number, counter: number = 0) => {
+    if (!isMounted.current) {
+      return;
+    }
     try {
       const desired = await api
         .getInfraDesired("<token>", {}, { project_id, infra_id })