From 2cdbf3774594b3078764bd6b0b837cfcdb081ba3 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Fri, 8 Jul 2022 18:01:50 +0800 Subject: [PATCH] fix(console): add unsaved changes warning in settings page --- packages/console/src/pages/Settings/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/console/src/pages/Settings/index.tsx b/packages/console/src/pages/Settings/index.tsx index 2a7955add..4b35879b3 100644 --- a/packages/console/src/pages/Settings/index.tsx +++ b/packages/console/src/pages/Settings/index.tsx @@ -12,6 +12,7 @@ import CardTitle from '@/components/CardTitle'; import FormField from '@/components/FormField'; import Select from '@/components/Select'; import TabNav, { TabNavItem } from '@/components/TabNav'; +import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal'; import useUserPreferences, { UserPreferences } from '@/hooks/use-user-preferences'; import * as detailsStyles from '@/scss/details.module.scss'; @@ -27,7 +28,7 @@ const Settings = () => { const { handleSubmit, control, - formState: { isSubmitting }, + formState: { isSubmitting, isDirty }, } = useForm({ defaultValues: data }); const onSubmit = handleSubmit(async (formData) => { @@ -113,6 +114,7 @@ const Settings = () => { )} + ); };