Repository navigation
fix(bridge): disable swap-and-bridge on the Hooks tab - #7696
fairlighteth merged 6 commits into
Conversation
Hooks orders are partially-fillable (PF), but bridge orders do not support partial fills. When a hook order is partially filled and the remaining bridging step is triggered, the order can get stuck in the 'Bridging' state indefinitely. Restrict the bridging feature to the Swap route only. The Safe-widget flag, `disableCrossChainSwap` widget param, and bridge-provider availability checks continue to apply. Closes cowprotocol#7490
|
@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
ChangesRestrict bridging to Swap route
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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-7696 Source fork branch:
|
elena-zh
left a comment
There was a problem hiding this comment.
Hey @tenderdeve , thank you, it works fine.
However, there is 1 nitpick: it would be nice to reset URL parameters to deafult one and remove a cross-chain swap reference from there when navigating from Swap to the Hooks tab.
Pls, compare it with navigation to limit orders page.
`useGetTradeUrlParams` only kept the cross-chain output token when the target tab was Swap or Hooks. Since bridging is now disabled on the Hooks tab, navigating from a bridging Swap to Hooks would carry over the destination-chain token in the URL even though the Hooks form cannot use it. Restrict the "keep current trade context" branch to Swap only, so any non-Swap navigation (Hooks included) falls back to default assets on the current chain. Addresses @elena-zh's review on cowprotocol#7696.
fairlighteth
left a comment
There was a problem hiding this comment.
✅ AI Review (Codex GPT-5, worked 2m): no new findings
Review completed. I found no new non-duplicate comments worth posting.
Related context checked
- Current head:
d4aad14e96. BridgingEnabledUpdater.ts:29: Hooks is excluded from bridge-enabled routes; Swap, Safe-widget, widget param, and provider gates remain covered by the same predicate.useGetTradeUrlParams.ts:25: prior feedback is addressed; cross-chain URL state is dropped when leaving Swap, including Hooks.- Existing review context: the main behavior was manually confirmed, then approved after the URL-reset fix.
- CI:
BridgingEnabledUpdater.test.tsxpassed; Test/Lint/Typecheck/Agent Harness passed. Cypress failed becauseINTEGRATION_TEST_PRIVATE_KEYis missing, so I did not treat it as PR-specific evidence.
Generated using the pr-review skill from the CoW Protocol skills repo.
🧪 Scoped browser QA passed: disconnected Hooks bridge gating; live bridge quote path not checkedOutcome
Run details
Artifacts
How to retest
Generated using the |


Summary
Fixes #7490
Hooks orders are partially-fillable (PF), but bridge orders do not support partial fills. When a hook order is partially filled and the bridging step kicks in for the remaining amount, the order can get stuck in the 'Bridging' state indefinitely.
This PR restricts the bridging feature to the Swap route only.
BridgingEnabledUpdaterpreviously enabled bridging on bothRoutes.SWAPandRoutes.HOOKS; the Hooks route is now excluded.The Safe-widget feature flag (
isBridgingInSafeWidgetEnabled), thedisableCrossChainSwapwidget param, and bridge-provider availability checks continue to apply on the Swap route.To Test
Hooks tab — bridging disabled
/swap/hooksSwap tab — bridging unchanged
/swapdisableCrossChainSwap=truewidget param still hides bridgingisBridgingInSafeWidgetEnabledflag, bridging remains hiddenLimit / Yield / other routes
Background
The fix is in
apps/cowswap-frontend/src/modules/bridge/updaters/BridgingEnabledUpdater.ts, the sole producer of the globalisBridgingEnabledAtom. Consumers ofuseIsBridgingEnabled(routes availability, supported tokens, swap-and-bridge UI) propagate the disabled state automatically.A unit test
BridgingEnabledUpdater.test.tsxcovers:disableCrossChainSwapwidget param respectedA code comment was added to explain why Hooks is excluded so the constraint isn't dropped by future refactors.
Summary by CodeRabbit
Changes
Tests