Skip to content

Commit

Permalink
Fix: Navigate to design page on settings save
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamG640 committed Dec 24, 2024
1 parent 6ca0112 commit 17b449d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ui/src/assets/settingsSchema.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/src/components/Settings/SettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -20,6 +23,7 @@ export const SettingsForm: FunctionComponent = () => {
const onSave = useCallback(() => {
settingsAdapter.saveSettings(settings);
reloadPage();
navigate(Links.Home);
}, [reloadPage, settings, settingsAdapter]);

return (
Expand Down

0 comments on commit 17b449d

Please sign in to comment.