Skip to content

Commit

Permalink
fix: handle max available value updates on delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
belopash committed Jun 11, 2024
1 parent c56cafe commit 6c9011e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/WorkersPage/WorkerDelegate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ export function WorkerDelegate({

useEffect(() => {
if (isSourceLoading) return;
else if (formik.values.source) return;

const source = sources.find(c => fromSqd(c.balance).gte(0)) || sources?.[0];
const source =
(formik.values.source
? sources.find(c => c.id === formik.values.source)
: sources.find(c => fromSqd(c.balance).gte(0))) || sources?.[0];
if (!source) return;

formik.setValues({
Expand Down

0 comments on commit 6c9011e

Please sign in to comment.