Skip to content

Commit

Permalink
fix(renterd): stop sending invalid evaluations before initial validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Oct 23, 2024
1 parent 7332f65 commit b68271a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-bananas-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Fixed an issue where the app was sending invalid autopilot evaluation requests before all the required data was entered by the user.
10 changes: 9 additions & 1 deletion apps/renterd/contexts/config/useForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ export function useForm({ resources }: { resources: ResourcesMaybeLoaded }) {
defaultValue: 'basic',
})

// Trigger input validation on configViewMode change because many field validation
// Trigger validation when the form is first setup.
// This is necessary because otherwise the form will not validate until the
// actual fields are rendered on screen, but we use isValid for other things
// such as deciding whether to submit autopilot config evaluations.
useEffect(() => {
form.trigger()
}, [form])

// Trigger validation on configViewMode change because many field validation
// objects switch from required to not required.
useEffect(() => {
form.trigger()
Expand Down

0 comments on commit b68271a

Please sign in to comment.