From 4034a1027a48d639301c76875b8b64e77a8ed844 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Tue, 8 Oct 2024 12:17:56 +0530 Subject: [PATCH] environment discard changes on tab switching works fine --- lib/client/hooks/use-unsaved-changes.tsx | 7 +++---- .../$environment+/app+/$app+/settings+/_layout.tsx | 10 +++++----- .../new-app/app-environment-variables.tsx | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/client/hooks/use-unsaved-changes.tsx b/lib/client/hooks/use-unsaved-changes.tsx index a5019f19d..33a16c359 100644 --- a/lib/client/hooks/use-unsaved-changes.tsx +++ b/lib/client/hooks/use-unsaved-changes.tsx @@ -68,8 +68,8 @@ export const UnsavedChangesProvider = ({ } return hasChanges; }, - [hasChanges], - ), + [hasChanges] + ) ); useEffect(() => { @@ -122,7 +122,7 @@ export const UnsavedChangesProvider = ({ performAction, setPerformAction, s, - ], + ] )} > {children} @@ -163,6 +163,5 @@ export const DISCARD_ACTIONS = { }; export const useUnsavedChanges = () => { - // const return useContext(UnsavedChanges); }; diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx index 2408520a2..579cfcf8e 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx @@ -70,8 +70,8 @@ const Layout = () => { setIgnorePaths( navItems.map( (ni) => - `/${account}/env/${environment}/app/${appName}/settings/${ni.value}`, - ), + `/${account}/env/${environment}/app/${appName}/settings/${ni.value}` + ) ); }, []); @@ -144,11 +144,11 @@ const Layout = () => { if (app.ciBuildId) { if ( readOnlyApp.spec.containers?.[0].image.includes( - constants.defaultAppRepoNameOnly, + constants.defaultAppRepoNameOnly ) ) { return `${constants.defaultAppRepoName( - accountName, + accountName )}:${tagName}`; } return `${registryHost}/${accountName}/${ @@ -159,7 +159,7 @@ const Layout = () => { }`; } return `${constants.defaultAppRepoName( - accountName, + accountName )}:${tagName}`; })(), name: 'container-0', diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx index 7f29ac812..fd1ade897 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx @@ -246,7 +246,7 @@ export const EnvironmentVariables = () => { initialValues: getReadOnlyContainer().env || null, validationSchema: Yup.array(entry), onSubmit: (val) => { - //@ts-ignore + // @ts-ignore setContainer((c) => ({ ...c, env: val,