Skip to content

Conversation

@fairlighteth
Copy link
Contributor

Summary

Completed step five of the token-selector split plan by wiring the advanced-trade guardrails into the widget state/hooks, introducing canonical chain ordering, and adding Jest coverage plus helper utilities so future PRs can reuse the sorted view.

  • Selector state now stores tradeType/forceOpen, and every open/close/select-chain path respects the limit/TWAP requirements so the modal stays mounted while users flip chains but still closes cleanly once a token is chosen.
  • useChainsToSelect was refactored into single/input/output builders with clear fallbacks and the new sortChainsByDisplayOrder helper so the sidebar always mirrors the main network selector order.
  • Added createChainInfoForTests and a focused Jest suite to lock in the sell-side and bridge-destination ordering guarantees, plus exported the updated hook for upcoming trade-widget plumbing.

Tests:

  • npx nx run cowswap-frontend:test --runTestsByPath apps/cowswap-frontend/src/modules/tokensList/hooks/useChainsToSelect.test.ts

To Test

  1. Swap flow — open the sell-token selector on a connected wallet
  • Chains list matches the canonical network order from the main selector
  • Closing the selector still works even after switching chains
  1. Limit/TWAP flow — open the sell selector, then switch chains and select a token
  • Widget stays open while switching chains (guardrail respected)
  • Selecting a token closes the selector even if a network switch is pending
  • Recent/favorite selections still update after the forced-close path

Background

Part of the staged token-selector rollout; this branch ensures the chain sidebar logic matches the documented plan before the trade-widget plumbing (step six) begins.

@fairlighteth fairlighteth self-assigned this Nov 14, 2025
@vercel
Copy link

vercel bot commented Nov 14, 2025

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

Project Deployment Preview Updated (UTC)
cowfi Ready Ready Preview Nov 14, 2025 10:19am
explorer-dev Ready Ready Preview Nov 14, 2025 10:19am
sdk-tools Ready Ready Preview Nov 14, 2025 10:19am
swap-dev Ready Ready Preview Nov 14, 2025 10:19am
widget-configurator Ready Ready Preview Nov 14, 2025 10:19am
1 Skipped Deployment
Project Deployment Preview Updated (UTC)
cosmos Ignored Ignored Nov 14, 2025 10:19am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/token-selector-5

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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