diff --git a/packages/widget/src/components/TokenList/useTokenSelect.ts b/packages/widget/src/components/TokenList/useTokenSelect.ts index 4e2dbb3d9..6de6c1cf7 100644 --- a/packages/widget/src/components/TokenList/useTokenSelect.ts +++ b/packages/widget/src/components/TokenList/useTokenSelect.ts @@ -17,7 +17,10 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => { const emitter = useWidgetEvents() const { setFieldValue, getFieldValues } = useFieldActions() const autoPopulateToAddress = useToAddressAutoPopulate() - const setChain = useChainOrderStore((state) => state.setChain) + const [setChain, setIsAllNetworks] = useChainOrderStore((state) => [ + state.setChain, + state.setIsAllNetworks, + ]) const tokenKey = FormKeyHelper.getTokenKey(formType) @@ -67,12 +70,18 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => { } // If no opposite token is selected, synchronize the opposite chain - // to match the currently selected chain (if allowed) + // to match the currently selected chain (if allowed). + // In default exchange mode, also collapse "All Networks" on the opposite + // side - same-chain swap is the most common action. if ( !selectedOppositeTokenAddress && selectedChainId && isItemAllowed(selectedChainId, chainsConfig?.[oppositeFormType]) ) { + const isDefaultExchange = !subvariant || subvariant === 'default' + if (isDefaultExchange) { + setIsAllNetworks(false, oppositeFormType) + } setFieldValue( FormKeyHelper.getChainKey(oppositeFormType), selectedChainId, @@ -115,6 +124,7 @@ export const useTokenSelect = (formType: FormType, onClick?: () => void) => { getFieldValues, onClick, setChain, + setIsAllNetworks, setFieldValue, subvariant, splitSubvariant,