Repository navigation
fix(address-input): drop chain-prefix warning when recipient is cleared - #7720
Conversation
The chain-prefix warning (e.g. "plasma:" pasted into a Base recipient
field) was only reset inside \`useOnAddressInput.handleInput\`. The
\"Clear\" button invokes \`onChange('')\` directly and never triggers
\`handleInput\`, so the warning stayed visible above an empty field
until the user typed something or re-pasted.
Pass the current input \`value\` into \`useOnAddressInput\` and reset
\`chainPrefixWarning\` whenever it goes empty, covering the Clear button,
QR-scan reset, and any future external reset path.
Closes cowprotocol#7687
|
@tenderdeve is attempting to deploy a commit to the cow-dev Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesChain-prefix warning clear on empty recipient input
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Cloudflare Pages preview mirror Preview branch URL: https://github.com/cowprotocol/cowswap/tree/cf-preview/pr-7720 Source fork branch:
|
…nt-prefix-warning-clear
fairlighteth
left a comment
There was a problem hiding this comment.
⚠️ AI Review (Codex GPT-5, worked 5m): add a regression test for the cleared warning
Finding: [NON-BLOCKING] Add coverage for the external clear path
- Location:
apps/cowswap-frontend/src/common/pure/AddressInputPanel/hooks/useOnAddressInput.ts:46 - The fix looks aligned with issue #7687, but the existing
useOnAddressInput.test.tsstill only covers input-driven resets andaddressPrefixchanges. - A focused regression test would catch this exact bug if the external
value -> ''sync is changed later.
Suggested fix
- Add a hook test that creates a wrong-prefix warning, rerenders the hook with
value: '', and expectschainPrefixWarningto clear. - Alternatively, cover the same flow at
AddressInputPanellevel by clickingClearafter a wrong-prefixed recipient.
Review scope and related context
Checked against the current PR head and linked issue #7687. I found no blocker: the clear-button fix matches the reported AR/ER. Existing PR context has no inline review threads; CodeRabbit generated no actionable comments, and there is one human approval.
🤖 Prompt for AI agents
Verify this finding against current PR code. If still valid, add a minimal regression test for useOnAddressInput.
Context:
- Changed code: apps/cowswap-frontend/src/common/pure/AddressInputPanel/hooks/useOnAddressInput.ts
- Existing tests: apps/cowswap-frontend/src/common/pure/AddressInputPanel/hooks/useOnAddressInput.test.ts
- Expected coverage: after a wrong-prefix warning exists, rerendering with value='' clears chainPrefixWarning.
Generated using the pr-review skill from the CoW Protocol skills repo.
Add regression test for useOnAddressInput: after a wrong-prefix warning exists, rerendering with an empty value clears chainPrefixWarning. Guards the Clear-button path that syncs value to '' without going through handleInput. Addresses @fairlighteth's review feedback.
|
@fairlighteth added the regression test in 219e9fd — after a wrong-prefix warning exists, rerendering |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Closes #7687.
On the swap page with custom recipient enabled, pasting a chain-prefixed address that doesn't match the source chain (e.g. `plasma:0x…` on Base) shows a "wrong prefix" warning above the input. Clicking the Clear button on the recipient field emptied the input but left the warning hanging, because the warning was only reset inside `useOnAddressInput.handleInput` — and Clear bypasses that path (it just calls `onChange('')`).
Fix
Pass the current input `value` into `useOnAddressInput` and clear `chainPrefixWarning` whenever it becomes empty. Covers the Clear button, QR-scan reset, and any future external reset.
Files
Testing steps
Summary by CodeRabbit