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): add autopilot configured check to evaluations #796

Merged
Merged
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
13 changes: 12 additions & 1 deletion apps/renterd/contexts/config/useAutopilotEvaluations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { objectEntries } from '@siafoundation/design-system'
import { currencyOptions } from '@siafoundation/react-core'
import {
useAutopilotConfigEvaluate,
useAutopilotState,
useBusState,
} from '@siafoundation/renterd-react'
import { humanNumber, humanSiacoin, toHastings } from '@siafoundation/units'
Expand Down Expand Up @@ -42,6 +43,7 @@ export function useAutopilotEvaluations({
}) {
const values = form.watch()
const renterdState = useBusState()
const autopilotState = useAutopilotState()

const hasDataToEvaluate = useMemo(() => {
if (!isAutopilotEnabled) {
Expand All @@ -56,8 +58,17 @@ export function useAutopilotEvaluations({
if (!renterdState.data) {
return false
}
if (!autopilotState.data?.configured) {
return false
}
return true
}, [isAutopilotEnabled, form.formState.isValid, resources, renterdState.data])
}, [
isAutopilotEnabled,
form.formState.isValid,
resources,
renterdState.data,
autopilotState.data,
])

// Convert any pinned fields over to siacoin values.
const allowance = useEnabledAllowanceInSiacoin({
Expand Down
Loading