fix(trade): preserve visible recipient URL flow#7611
Conversation
- keep URL-driven visible recipients populated after mount - add regression coverage for recipient URL parsing and reset flow
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Deploying explorer-dev with
|
| Latest commit: |
b9c02ce
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://670c2b92.explorer-dev-dxz.pages.dev |
| Branch Preview URL: | https://fix-recipient-url-initializa.explorer-dev-dxz.pages.dev |
Deploying swap-dev with
|
| Latest commit: |
b9c02ce
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6dc4ac63.swap-dev-5u6.pages.dev |
| Branch Preview URL: | https://fix-recipient-url-initializa.swap-dev-5u6.pages.dev |
✅ AI Review (Codex GPT-5, worked 1m32s): no new non-duplicate findingsI rechecked the current diff and did not find any new non-duplicate issues worth posting. Review scope and related contextChecked:
Notes:
|





Summary
Follow-up on #7601 to restore the supported visible custom recipient URL flow without weakening the hardening.
This PR fixes an existing regression already present on production and develop:
?recipient=<value>shows the visible recipient section, but the field gets cleared during initialization and ends up empty.This is a bug fix, not a behavior change.
recipient=<value>was already the intended supported visible URL flow. The PR keepsrecipientAddressintentionally unsupported from the URL, but preservesrecipient=<value>so the visible recipient section stays populated after initialization instead of being cleared on mount.What changed:
recipientAddressfrom the URLrecipientAddress=...from activating recipient mode by itselfrecipient=<value>as the supported visible custom recipient URL flowAutomated verification:
pnpm exec jest --config apps/cowswap-frontend/jest.config.mjs --runInBand apps/cowswap-frontend/src/modules/trade/hooks/setupTradeState/useSetupTradeStateFromUrl.test.ts apps/cowswap-frontend/src/modules/trade/hooks/useResetRecipient.test.ts apps/cowswap-frontend/src/modules/trade/hooks/useWithRecipient.test.tspnpm exec eslint apps/cowswap-frontend/src/modules/trade/hooks/useResetRecipient.ts apps/cowswap-frontend/src/modules/trade/hooks/useResetRecipient.test.ts apps/cowswap-frontend/src/modules/trade/hooks/setupTradeState/useSetupTradeStateFromUrl.test.ts apps/cowswap-frontend/src/modules/trade/hooks/useWithRecipient.test.tsTo Test
Open:
#/1/swap/WETH/1INCH?recipient=Open:
#/1/swap/WETH/1INCH?recipientAddress=0x000000000000000000000000000000000000dEaDOpen:
#/1/swap/WETH/1INCH?recipient=0x000000000000000000000000000000000000dEaD0x000000000000000000000000000000000000dEaDOpen:
#/1/swap/WETH/CtzPWv73Sn1dMGVU3ZtLv9yWSyUAanBni19YWDaznnkn?targetChainId=1000000001&recipient=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1vEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1vOpen:
#/1/swap/WETH/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa?targetChainId=1000000000&recipient=bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4Background
This regression already exists in production/develop today. The supported visible URL param
recipientis still present in URL state and still controls whether the recipient UI appears, but the live recipient value gets cleared during initialization.useIsWithRecipient()still uses URLrecipientto decide whether the visible recipient UI should appear, which is the intended supported flow.The bug was in
useResetRecipient(): generic reset effects were still clearing the live recipient state during initialization, so the UI could appear while the field ended up empty.This change only preserves URL-backed visible recipients through initialization. It does not reintroduce support for hidden
recipientAddressURL state.