From 72dbef97fb675161a767182001b3d2c3dcb9a729 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Tue, 4 Mar 2025 10:14:56 -0800 Subject: [PATCH 1/2] improvement: clear query params after setup to avoid false error messages --- .../organization/SecretScanningPage/SecretScanningPage.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx b/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx index 2b07ee2a3..58e04e87c 100644 --- a/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx +++ b/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx @@ -2,7 +2,7 @@ import { useEffect } from "react"; import { Helmet } from "react-helmet"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; -import { useSearch } from "@tanstack/react-router"; +import { useNavigate, useSearch } from "@tanstack/react-router"; import { OrgPermissionCan } from "@app/components/permissions"; import { Button, NoticeBanner, PageHeader, Pagination } from "@app/components/v2"; @@ -36,6 +36,8 @@ export const SecretScanningPage = withPermission( from: ROUTE_PATHS.Organization.SecretScanning.id }); + const navigate = useNavigate(); + const { control, watch } = useForm({ resolver: zodResolver(secretScanningFilterFormSchema), defaultValues: {} @@ -86,6 +88,9 @@ export const SecretScanningPage = withPermission( sessionId: String(queryParams.state) }); if (isLinked) { + await navigate({ + to: "/organization/secret-scanning" + }); window.location.reload(); } From 5c606fe45f4cb711e10b7453939aca1dcf6a9ff1 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Tue, 4 Mar 2025 10:39:40 -0800 Subject: [PATCH 2/2] improvement: replace window reload with query refetch --- .../SecretScanningPage/SecretScanningPage.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx b/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx index 58e04e87c..ba919cdd3 100644 --- a/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx +++ b/frontend/src/pages/organization/SecretScanningPage/SecretScanningPage.tsx @@ -72,8 +72,11 @@ export const SecretScanningPage = withPermission( const { mutateAsync: linkGitAppInstallationWithOrganization } = useLinkGitAppInstallationWithOrg(); const { mutateAsync: createNewIntegrationSession } = useCreateNewInstallationSession(); - const { data: installationStatus, isPending: isSecretScanningInstatllationStatusLoading } = - useGetSecretScanningInstallationStatus(organizationId); + const { + data: installationStatus, + isPending: isSecretScanningInstatllationStatusLoading, + refetch: refetchSecretScanningInstallationStatus + } = useGetSecretScanningInstallationStatus(organizationId); const integrationEnabled = !isSecretScanningInstatllationStatusLoading && installationStatus?.appInstallationCompleted; @@ -91,7 +94,7 @@ export const SecretScanningPage = withPermission( await navigate({ to: "/organization/secret-scanning" }); - window.location.reload(); + refetchSecretScanningInstallationStatus(); } console.log("installation verification complete");