From edb3e662672d52f23f6d8a3d9e14f2e5bc2a3c17 Mon Sep 17 00:00:00 2001 From: Akhil Mohan Date: Thu, 14 Sep 2023 21:56:57 +0530 Subject: [PATCH] fix(integrations): resolved integration bot deactive revoke bug --- .../views/IntegrationsPage/IntegrationsPage.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx b/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx index e8e4e5b2c..0f2f8a97d 100644 --- a/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx +++ b/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx @@ -85,7 +85,13 @@ export const IntegrationsPage = withProjectPermission( // details: so onsuccessfully deleting an integration auth, immediately integration list is refeteched // After the refetch is completed check if its empty. Then set bot active and reset the submit hook useEffect(() => { - if (isDeleteIntegrationAuthSuccess && !isIntegrationFetching && !integrations?.length) { + if ( + isDeleteIntegrationAuthSuccess && + !isIntegrationFetching && + !isIntegrationAuthLoading && + !integrations?.length && + !integrationAuths?.length + ) { if (bot?._id) updateBotActiveStatusSync({ isActive: false, @@ -94,7 +100,13 @@ export const IntegrationsPage = withProjectPermission( }); resetDeleteIntegrationAuth(); } - }, [isIntegrationFetching, isDeleteIntegrationAuthSuccess, integrations?.length]); + }, [ + isIntegrationFetching, + isDeleteIntegrationAuthSuccess, + isIntegrationAuthLoading, + integrationAuths?.length, + integrations?.length + ]); const handleProviderIntegration = async (provider: string) => { const selectedCloudIntegration = cloudIntegrations?.find(({ slug }) => provider === slug);