Skip to content

Commit

Permalink
fix(console): add unsaved changes warning in settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
charIeszhao committed Jul 8, 2022
1 parent b8aea3b commit 2cdbf37
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/console/src/pages/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -27,7 +28,7 @@ const Settings = () => {
const {
handleSubmit,
control,
formState: { isSubmitting },
formState: { isSubmitting, isDirty },
} = useForm<UserPreferences>({ defaultValues: data });

const onSubmit = handleSubmit(async (formData) => {
Expand Down Expand Up @@ -113,6 +114,7 @@ const Settings = () => {
</div>
</form>
)}
<UnsavedChangesAlertModal hasUnsavedChanges={isDirty} />
</Card>
);
};
Expand Down

0 comments on commit 2cdbf37

Please sign in to comment.