Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(app-connections): standardize add sheet discard handling (#7942)

Andrew Huang3a76c12471d1
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AddAppConnectionModal.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AddAppConnectionModal.tsx
index b7fbee63cf..a2e2c90096 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AddAppConnectionModal.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AddAppConnectionModal.tsx
@@ -1,22 +1,15 @@
-import { useEffect, useState } from "react";
-import { AlertTriangleIcon, ArrowLeftIcon } from "lucide-react";
+import { useCallback, useEffect, useRef, useState } from "react";
+import { ArrowLeftIcon } from "lucide-react";
import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogMedia,
- AlertDialogTitle,
+ DiscardChangesAlertDialog,
Sheet,
SheetContent,
SheetDescription,
SheetHeader,
SheetTitle
} from "@app/components/v3";
+import { useDiscardChangesGuard } from "@app/hooks";
import { TAppConnection } from "@app/hooks/api/appConnections";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { ProjectType } from "@app/hooks/api/projects/types";
@@ -45,19 +38,40 @@ export const AddAppConnectionModal = ({
// When `app` is preset (inline create from another flow, or an OAuth reopen) we skip the provider
// select screen and go straight to that app's form. Otherwise the user picks a provider first.
const [selectedApp, setSelectedApp] = useState<AppConnection | null>(app ?? null);
- const [confirmDiscardOpen, setConfirmDiscardOpen] = useState(false);
+ const [isDirty, setIsDirty] = useState(false);
+ const discardActionRef = useRef<VoidFunction>(() => {});
// Reset to the starting step whenever the sheet (re)opens: a preset `app` goes straight to its
// form, otherwise the provider picker. Keyed on `isOpen` so reopening with an unchanged preset
// `app` (inline create flows keep the modal mounted) still restores the form instead of falling
// back to the picker.
useEffect(() => {
- if (isOpen) setSelectedApp(app ?? null);
+ if (isOpen) {
+ setSelectedApp(app ?? null);
+ setIsDirty(false);
+ }
}, [isOpen, app]);
- const closeSheet = () => {
+ const closeSheet = useCallback(() => {
+ setIsDirty(false);
setSelectedApp(null);
onOpenChange(false);
+ }, [onOpenChange]);
+
+ const returnToAppSelect = useCallback(() => {
+ setIsDirty(false);
+ setSelectedApp(null);
+ }, []);
+
+ const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =
+ useDiscardChangesGuard({
+ isDirty,
+ onDiscard: () => discardActionRef.current()
+ });
+
+ const requestDiscardAction = (action: VoidFunction) => {
+ discardActionRef.current = action;
+ requestDiscard();
};
const handleComplete = (appConnection: TAppConnection) => {
@@ -66,13 +80,11 @@ export const AddAppConnectionModal = ({
};
const handleSheetOpenChange = (nextOpen: boolean) => {
- if (!nextOpen && selectedApp) {
- // User has started configuring a connection — confirm before discarding.
- setConfirmDiscardOpen(true);
+ if (!nextOpen) {
+ requestDiscardAction(closeSheet);
return;
}
- if (!nextOpen) setSelectedApp(null);
- onOpenChange(nextOpen);
+ onOpenChange(true);
};
// Only offer "back to select" when the user navigated here from the select screen (no preset app).
@@ -88,7 +100,7 @@ export const AddAppConnectionModal = ({
{showBack && (
<button
type="button"
- onClick={() => setSelectedApp(null)}
+ onClick={() => requestDiscardAction(returnToAppSelect)}
className="mb-1 flex w-fit cursor-pointer items-center gap-1 text-xs text-muted transition-colors hover:text-foreground hover:underline"
>
<ArrowLeftIcon className="size-3" />
@@ -112,39 +124,31 @@ export const AddAppConnectionModal = ({
app={selectedApp}
projectId={projectId}
onComplete={handleComplete}
- // Explicit Cancel is a deliberate abandon, so it closes immediately. Ambiguous
- // dismissals (X / Escape / outside click) route through handleSheetOpenChange,
- // which shows the discard confirmation.
- onCancel={closeSheet}
+ onCancel={() => requestDiscardAction(closeSheet)}
+ onDirtyChange={setIsDirty}
/>
</div>
) : (
<div className="flex min-h-0 flex-1 flex-col overflow-y-auto p-4">
- <AppConnectionsSelect onSelect={setSelectedApp} projectType={projectType} />
+ <AppConnectionsSelect
+ onSelect={(nextApp) => {
+ setIsDirty(false);
+ setSelectedApp(nextApp);
+ }}
+ projectType={projectType}
+ />
</div>
)}
</SheetContent>
</Sheet>
- <AlertDialog open={confirmDiscardOpen} onOpenChange={setConfirmDiscardOpen}>
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogMedia>
- <AlertTriangleIcon />
- </AlertDialogMedia>
- <AlertDialogTitle>Discard connection setup?</AlertDialogTitle>
- <AlertDialogDescription>
- Your progress configuring this connection will be lost.
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel>Keep Editing</AlertDialogCancel>
- <AlertDialogAction variant="danger" onClick={closeSheet}>
- Discard
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
+ <DiscardChangesAlertDialog
+ open={isDiscardDialogOpen}
+ onOpenChange={setIsDiscardDialogOpen}
+ onDiscard={confirmDiscard}
+ title="Discard Connection Setup?"
+ description="Your progress configuring this connection will be lost."
+ />
</>
);
};
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index 2da9a70e17..bb3648bb86 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -683,15 +683,19 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
);
};
-type Props = { onCancel: () => void; projectId?: string } & Pick<FormProps, "onComplete"> &
+type Props = {
+ onCancel: () => void;
+ onDirtyChange?: (isDirty: boolean) => void;
+ projectId?: string;
+} & Pick<FormProps, "onComplete"> &
(
| { app: AppConnection; appConnection?: undefined }
| { app?: undefined; appConnection: TAppConnection }
);
-export const AppConnectionForm = ({ onCancel, projectId, ...props }: Props) => {
+export const AppConnectionForm = ({ onCancel, onDirtyChange, projectId, ...props }: Props) => {
const { app, appConnection } = props;
- const contextValue = useMemo(() => ({ onCancel }), [onCancel]);
+ const contextValue = useMemo(() => ({ onCancel, onDirtyChange }), [onCancel, onDirtyChange]);
return (
<AppConnectionFormProvider value={contextValue}>
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormContext.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormContext.tsx
index 9cde0f5ab1..ee8e93817d 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormContext.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormContext.tsx
@@ -1,4 +1,4 @@
-import { createContext, useContext } from "react";
+import { createContext, useContext, useEffect } from "react";
type AppConnectionFormContextValue = {
/**
@@ -6,6 +6,7 @@ type AppConnectionFormContextValue = {
* have to thread a prop through every form and the ~130 render sites in AppConnectionForm.
*/
onCancel: () => void;
+ onDirtyChange?: (isDirty: boolean) => void;
};
const AppConnectionFormContext = createContext<AppConnectionFormContextValue>({
@@ -15,3 +16,11 @@ const AppConnectionFormContext = createContext<AppConnectionFormContextValue>({
export const AppConnectionFormProvider = AppConnectionFormContext.Provider;
export const useAppConnectionForm = () => useContext(AppConnectionFormContext);
+
+export const useAppConnectionFormDirtyState = (isDirty: boolean) => {
+ const { onDirtyChange } = useAppConnectionForm();
+
+ useEffect(() => {
+ onDirtyChange?.(isDirty);
+ }, [isDirty, onDirtyChange]);
+};
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormFooter.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormFooter.tsx
index 868ecf90fa..34f28608ae 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormFooter.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionFormFooter.tsx
@@ -3,7 +3,7 @@ import { useFormContext } from "react-hook-form";
import { Button, SheetFooter } from "@app/components/v3";
import { useScopeVariant } from "@app/hooks";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
type Props = {
submitLabel: string;
@@ -27,6 +27,8 @@ export const AppConnectionFormFooter = ({
} = useFormContext();
const scopeVariant = useScopeVariant();
+ useAppConnectionFormDirtyState(isDirty);
+
return (
<SheetFooter className="sticky bottom-0 -mx-4 items-center border-t bg-popover">
<Button
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureAppConfigurationConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureAppConfigurationConnectionForm.tsx
index 3cd6246bcd..9c3f5e6d26 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureAppConfigurationConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureAppConfigurationConnectionForm.tsx
@@ -38,7 +38,7 @@ import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { AzureAppConfigurationFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
import { CredentialRotationForm } from "./shared/CredentialRotationForm";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -163,6 +163,8 @@ export const AzureAppConfigurationConnectionForm = ({
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const scopeVariant = useScopeVariant();
const selectedMethod = watch("method");
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx
index 7c30c49e72..6efa06eae2 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx
@@ -40,7 +40,7 @@ import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { AzureClientSecretsFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
import { CredentialRotationForm } from "./shared/CredentialRotationForm";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -192,6 +192,8 @@ export const AzureClientSecretsConnectionForm = ({ appConnection, onSubmit, proj
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const scopeVariant = useScopeVariant();
const selectedMethod = watch("method");
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDevOpsConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDevOpsConnectionForm.tsx
index 42ae324921..4a3ad47a77 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDevOpsConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDevOpsConnectionForm.tsx
@@ -39,7 +39,7 @@ import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { AzureDevOpsFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
import { CredentialRotationForm } from "./shared/CredentialRotationForm";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -195,6 +195,8 @@ export const AzureDevOpsConnectionForm = ({ appConnection, onSubmit, projectId }
setValue
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const scopeVariant = useScopeVariant();
const selectedMethod = watch("method");
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx
index bff1b3fa2e..2dfabb3032 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx
@@ -28,7 +28,7 @@ import {
} from "@app/hooks/api/appConnections/types/azure-entra-id-connection";
import { CredentialRotationForm } from "./shared/CredentialRotationForm";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -99,6 +99,8 @@ export const AzureEntraIdConnectionForm = ({ appConnection, onSubmit }: Props) =
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const scopeVariant = useScopeVariant();
return (
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx
index 43aa470c4c..c3570e2307 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx
@@ -46,7 +46,7 @@ import {
import { AzureKeyVaultFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
import { CredentialRotationForm } from "./shared/CredentialRotationForm";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -202,6 +202,8 @@ export const AzureKeyVaultConnectionForm = ({ appConnection, onSubmit, projectId
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const scopeVariant = useScopeVariant();
const selectedMethod = watch("method");
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx
index 8a5694f2a4..9347a8b73f 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx
@@ -59,7 +59,7 @@ import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";
import { TGitHubApp, useListGitHubApps } from "@app/hooks/api/gitHubApps";
import { GitHubFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -212,6 +212,8 @@ export const GitHubConnectionForm = ({ appConnection, projectId, onSubmit }: Pro
// the Connect button enabled.
const [isResumed, setIsResumed] = useState(false);
+ useAppConnectionFormDirtyState(isDirty || isResumed);
+
// When we come back from creating a new GitHub App, restore the in-progress form and remember the
// new app so we can select it. The connection itself is created later when the user hits Connect.
useEffect(() => {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubRadarConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubRadarConnectionForm.tsx
index 52f62541fd..12057ce11a 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubRadarConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubRadarConnectionForm.tsx
@@ -36,7 +36,7 @@ import {
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { GitHubRadarFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -82,6 +82,8 @@ export const GitHubRadarConnectionForm = ({ appConnection, projectId }: Props) =
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const selectedMethod = watch("method");
const onSubmit = (formData: FormData) => {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx
index 1fd34dc941..a1711dda5d 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx
@@ -41,7 +41,7 @@ import {
} from "@app/hooks/api/appConnections/types/gitlab-connection";
import { GitLabFormData } from "../../../OauthCallbackPage/OauthCallbackPage.types";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -127,6 +127,8 @@ export const GitLabConnectionForm = ({ appConnection, onSubmit: formSubmit, proj
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const selectedMethod = watch("method");
const gitLabURL = watch("credentials.instanceUrl");
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx
index 42fc32eb7f..942af92962 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/HerokuAppConnectionForm.tsx
@@ -38,7 +38,7 @@ import {
THerokuConnection
} from "@app/hooks/api/appConnections/types/heroku-connection";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -105,6 +105,8 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit, proj
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const selectedMethod = watch("method");
const onSubmit = async (formData: FormData) => {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MicrosoftIntuneConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MicrosoftIntuneConnectionForm.tsx
index c9b04e7a02..faa32616d9 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MicrosoftIntuneConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/MicrosoftIntuneConnectionForm.tsx
@@ -27,7 +27,7 @@ import {
TMicrosoftIntuneConnection
} from "@app/hooks/api/appConnections/types/microsoft-intune-connection";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -85,6 +85,8 @@ export const MicrosoftIntuneConnectionForm = ({ appConnection, onSubmit }: Props
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const scopeVariant = useScopeVariant();
return (
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VenafiTppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VenafiTppConnectionForm.tsx
index fe6d991a6d..a203fff7ea 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VenafiTppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/VenafiTppConnectionForm.tsx
@@ -32,7 +32,7 @@ import { useScopeVariant } from "@app/hooks";
import { TVenafiTppConnection, VenafiTppConnectionMethod } from "@app/hooks/api/appConnections";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
-import { useAppConnectionForm } from "./AppConnectionFormContext";
+import { useAppConnectionForm, useAppConnectionFormDirtyState } from "./AppConnectionFormContext";
import {
genericAppConnectionFieldsSchema,
GenericAppConnectionsFields
@@ -96,6 +96,8 @@ export const VenafiTppConnectionForm = ({ appConnection, onSubmit }: Props) => {
formState: { isSubmitting, isDirty }
} = form;
+ useAppConnectionFormDirtyState(isDirty);
+
const gatewayId = watch("gatewayId");
const gatewayPoolId = watch("gatewayPoolId");
const { subscription } = useSubscription();