diff --git a/backend/src/services/RedisService.ts b/backend/src/services/RedisService.ts index a6ae5b026..23f945bb7 100644 --- a/backend/src/services/RedisService.ts +++ b/backend/src/services/RedisService.ts @@ -1,12 +1,12 @@ -import { Redis } from "ioredis" +import Redis, { Redis as TRedis } from "ioredis"; -let redisClient: Redis | null; +let redisClient: TRedis | null; if (process.env.REDIS_URL) { redisClient = new Redis(process.env.REDIS_URL as string); } else { console.warn("Redis URL not set, skipping Redis initialization."); - redisClient = null + redisClient = null; } -export { redisClient } \ No newline at end of file +export { redisClient }; diff --git a/backend/src/validation/secrets.ts b/backend/src/validation/secrets.ts index cc541ab9e..28e7f469d 100644 --- a/backend/src/validation/secrets.ts +++ b/backend/src/validation/secrets.ts @@ -270,7 +270,6 @@ export const UpdateSecretByNameRawV3 = z.object({ workspaceId: z.string().trim(), environment: z.string().trim(), secretValue: z.string().trim(), - secretName: z.string().trim(), secretPath: z.string().trim().default("/"), type: z.enum([SECRET_SHARED, SECRET_PERSONAL]).default(SECRET_SHARED) }) diff --git a/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx b/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx index 0f2f8a97d..fdc04af9d 100644 --- a/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx +++ b/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx @@ -51,17 +51,20 @@ export const IntegrationsPage = withProjectPermission( const { data: cloudIntegrations, isLoading: isCloudIntegrationsLoading } = useGetCloudIntegrations(); - const { data: integrationAuths, isLoading: isIntegrationAuthLoading } = - useGetWorkspaceAuthorizations( - workspaceId, - useCallback((data: IntegrationAuth[]) => { - const groupBy: Record = {}; - data.forEach((el) => { - groupBy[el.integration] = el; - }); - return groupBy; - }, []) - ); + const { + data: integrationAuths, + isLoading: isIntegrationAuthLoading, + isFetching: isIntegrationAuthFetching + } = useGetWorkspaceAuthorizations( + workspaceId, + useCallback((data: IntegrationAuth[]) => { + const groupBy: Record = {}; + data.forEach((el) => { + groupBy[el.integration] = el; + }); + return groupBy; + }, []) + ); // mutation const { data: integrations, @@ -77,20 +80,22 @@ export const IntegrationsPage = withProjectPermission( const { mutateAsync: deleteIntegration } = useDeleteIntegration(); const { mutateAsync: deleteIntegrationAuth, - isLoading: isDeleteIntegrationAuthSuccess, + isSuccess: isDeleteIntegrationAuthSuccess, reset: resetDeleteIntegrationAuth } = useDeleteIntegrationAuth(); + const isIntegrationsAuthorizedEmpty = !Object.keys(integrationAuths || {}).length; + const isIntegrationsEmpty = !integrations?.length; // summary: this use effect is trigger when all integration auths are removed thus deactivate bot - // 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 + // details: so on successfully 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 for isSuccess to go back to false useEffect(() => { if ( isDeleteIntegrationAuthSuccess && !isIntegrationFetching && - !isIntegrationAuthLoading && - !integrations?.length && - !integrationAuths?.length + !isIntegrationAuthFetching && + isIntegrationsAuthorizedEmpty && + isIntegrationsEmpty ) { if (bot?._id) updateBotActiveStatusSync({ @@ -103,9 +108,9 @@ export const IntegrationsPage = withProjectPermission( }, [ isIntegrationFetching, isDeleteIntegrationAuthSuccess, - isIntegrationAuthLoading, - integrationAuths?.length, - integrations?.length + isIntegrationAuthFetching, + isIntegrationsAuthorizedEmpty, + isIntegrationsEmpty ]); const handleProviderIntegration = async (provider: string) => {