Skip to content

fix(send): trigger validation on Max so Review enables immediately#2099

Merged
MusabShakeel576 merged 1 commit into
masterfrom
claude/send-max-validate-GDDOC
May 26, 2026
Merged

fix(send): trigger validation on Max so Review enables immediately#2099
MusabShakeel576 merged 1 commit into
masterfrom
claude/send-max-validate-GDDOC

Conversation

@MusabShakeel576
Copy link
Copy Markdown
Contributor

Summary

On the Send modal, clicking Max without typing first leaves the Review button disabled.

handleMaxPress calls setValue('amount', maxAmount), but react-hook-form's onChange mode only re-runs the Zod schema when the Controller's TextInput fires onChange. Programmatic setValue writes the value into form state but doesn't re-validate, so formState.isValid stays at whatever it was before (i.e., false on fresh mount because the schema's "Please enter a valid amount" refine on an empty string already failed). The Review button reads disabled={!selectedToken || !isValid} and stays disabled.

Call trigger('amount') after setValue — the same pattern CardRepayForm.tsx:387-388 and Unstake/RegularWithdrawForm.tsx:201-202 already use for the identical case. The setAmount Zustand call stays so the picker's downstream consumers see the new value.

Test plan

  • Open Send → pick a recipient → pick a token with non-zero balance
  • Without typing in the amount field, click Max
    • amount field fills with the full balance (already worked)
    • Review button becomes enabled (now works)
  • Type a custom amount after Max → field updates, Review still tracks validity correctly

https://claude.ai/code/session_013ovmPbLFvPhUCQq9qggyes


Generated by Claude Code

The form uses react-hook-form's onChange mode, which only re-runs the
Zod schema when the Controller's TextInput fires onChange. handleMaxPress
just calls setValue('amount', maxAmount), which writes the value but
doesn't run validation, so isValid stays at its prior value (false if
the user hadn't typed first) and the Review button remains disabled.

Call trigger('amount') after setValue — matches the pattern already
used in CardRepayForm and RegularWithdrawForm for the same problem.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
solid-app Ignored Ignored May 26, 2026 2:10pm
solid-app-staging Ignored Ignored May 26, 2026 2:10pm

Request Review

@MusabShakeel576 MusabShakeel576 merged commit 362acb2 into master May 26, 2026
4 of 5 checks passed
@MusabShakeel576 MusabShakeel576 deleted the claude/send-max-validate-GDDOC branch May 26, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants