Преглед на файлове

prevent api call to be made if component is not mounted

jnfrati преди 4 години
родител
ревизия
267ab41c32
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      dashboard/src/main/home/onboarding/steps/ProvisionResources/forms/StatusPage.tsx

+ 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) => {
   const getDesiredState = async (infra_id: number, counter: number = 0) => {
+    if (!isMounted.current) {
+      return;
+    }
     try {
     try {
       const desired = await api
       const desired = await api
         .getInfraDesired("<token>", {}, { project_id, infra_id })
         .getInfraDesired("<token>", {}, { project_id, infra_id })