Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(renterd): stop sending invalid evaluations before initial validation #793

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading