fix(site/src/pages/AISettingsPage/ModelsPage): disable Update model until form is dirty#26684
Merged
Merged
Conversation
…ntil form is dirty The Update model button on /ai/settings/models/:modelId was enabled on mount even when the form had not been edited, so it was possible to submit an unchanged update. Match the Provider form behavior (PR #25551) by gating the submit on form.dirty when editing. Add a dirty-state Storybook story and tighten EditSaveSubmits to assert the disabled-on-mount and enabled-after-edit transitions.
Contributor
Author
|
I didn't address the enable/disable getting auto applied. Changing that means we'll have to update the rest at the same time. Its also outside of the form box. So I believe for now its fine. With the toast notification. We can address in next round if needed. |
DanielleMaywood
approved these changes
Jun 24, 2026
Comment on lines
+233
to
+236
| // In edit mode the form starts pre-populated with the saved values, so | ||
| // without a dirty check the Update button would be enabled on mount. | ||
| // Require at least one change before allowing submit, matching the | ||
| // behavior of the Provider form (see PR #25551). |
Contributor
There was a problem hiding this comment.
Comments not needed, pls delete before merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Update model button on
/ai/settings/models/:modelIdwas enabled on mount even when the form had not been edited, so it was possible to submit an unchanged update. This matches the Provider form behavior already established in #25551 by gating submit onform.dirtywhen editing.Changes
ModelForm.tsxadds(!isEditing || form.dirty)to thecanSubmitpredicate so Update is disabled until the user changes a field. Add/duplicate flows are unaffected because their existingmodel.trim().length > 0requirement already enforces user input.ModelForm.stories.tsxtightensEditSaveSubmitsto assert the disabled-on-mount and enabled-after-edit transitions, and addsEditUpdateDisabledUntilDirtycovering the case where the user reverts an edit back to the original value.Verification
pnpm exec biome check src/pages/AISettingsPage/ModelsPage/components/ModelForm.tsx src/pages/AISettingsPage/ModelsPage/components/ModelForm.stories.tsx: cleanpnpm exec tsc -p . --noEmit: cleanpnpm test:storybook --project=chromium src/pages/AISettingsPage/ModelsPage: 21/21 stories pass (including the two new dirty-state stories)make pre-commitvia the project git hooks: passed (lint/ts, lint/go, lint/emdash, lint/agents, lint/check-scopes, build, all green)Note
🤖 This PR was written by Coder Agents on behalf of @tracyjohnsonux