Skip to content

Commit

Permalink
fix: clear input after changing bridge from chain
Browse files Browse the repository at this point in the history
  • Loading branch information
dmy147 committed Dec 19, 2024
1 parent 7baeea0 commit a157211
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/ui/views/Bridge/Component/BridgeToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,22 @@ export const BridgeToken = ({
[token, onInputChange, onChangeToken]
);

const changeChain = React.useCallback(
(newChain: CHAINS_ENUM) => {
if (chain !== newChain) {
onChangeChain(newChain);
if (isFromToken) {
onInputChange?.('');
setTimeout(() => {
inputRef?.current?.focus?.();
}, 200);
handleSetGasPrice?.();
}
}
},
[onChangeChain, chain, isFromToken, onInputChange, handleSetGasPrice]
);

useLayoutEffect(() => {
if (isFromToken) {
if (
Expand Down Expand Up @@ -243,7 +259,7 @@ export const BridgeToken = ({
mini
hideTestnetTab
value={chain}
onChange={onChangeChain}
onChange={changeChain}
title={<div className="mt-8">{t('page.bridge.select-chain')}</div>}
excludeChains={excludeChains}
supportChains={supportedChains}
Expand Down

0 comments on commit a157211

Please sign in to comment.