From 17b449d9a4d0bdf4424e0e98d65ee9778faf4fef Mon Sep 17 00:00:00 2001 From: Shivam Gupta Date: Tue, 24 Dec 2024 19:10:41 +0530 Subject: [PATCH] Fix: Navigate to design page on settings save --- packages/ui/src/assets/settingsSchema.json | 2 +- packages/ui/src/components/Settings/SettingsForm.tsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/assets/settingsSchema.json b/packages/ui/src/assets/settingsSchema.json index d7d9a84ef..1cc48b127 100644 --- a/packages/ui/src/assets/settingsSchema.json +++ b/packages/ui/src/assets/settingsSchema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "description": "JSON Schema for Kaoto configuration", diff --git a/packages/ui/src/components/Settings/SettingsForm.tsx b/packages/ui/src/components/Settings/SettingsForm.tsx index f41fbda21..a0defb12b 100644 --- a/packages/ui/src/components/Settings/SettingsForm.tsx +++ b/packages/ui/src/components/Settings/SettingsForm.tsx @@ -7,9 +7,12 @@ import { SettingsModel } from '../../models/settings'; import { SchemaBridgeProvider } from '../../providers/schema-bridge.provider'; import { SettingsContext } from '../../providers/settings.provider'; import { CustomAutoForm } from '../Form/CustomAutoForm'; +import { useNavigate } from 'react-router-dom'; +import { Links } from '../../router/links.models'; export const SettingsForm: FunctionComponent = () => { const settingsAdapter = useContext(SettingsContext); + const navigate = useNavigate(); const { lastRender, reloadPage } = useReloadContext(); const [settings, setSettings] = useState(settingsAdapter.getSettings()); @@ -20,6 +23,7 @@ export const SettingsForm: FunctionComponent = () => { const onSave = useCallback(() => { settingsAdapter.saveSettings(settings); reloadPage(); + navigate(Links.Home); }, [reloadPage, settings, settingsAdapter]); return (