File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -478,32 +478,43 @@ const SwapScreen = () => {
478478 ] ,
479479 )
480480
481+ useEffect ( ( ) => {
482+ setRecipient ( '' )
483+ setRecipientOpen ( false )
484+ setOutputAmount ( 0 )
485+ } , [
486+ inputMint ,
487+ inputAmount ,
488+ outputMint ,
489+ setRecipient ,
490+ setRecipientOpen ,
491+ setOutputAmount ,
492+ ] )
493+
481494 useEffect ( ( ) => {
482495 // if changing outputMint ensure we get new routes
483496 ; ( async ( ) => {
484497 if (
485498 ! isDevnet &&
486- inputMintAcc &&
487- outputMintAcc &&
499+ inputMintAcc ?. address === inputMint &&
500+ outputMintAcc ?. address === outputMint &&
488501 typeof inputAmount !== 'undefined' &&
489502 inputAmount > 0 &&
490503 ! outputMintAcc ?. address . equals ( DC_MINT )
491504 ) {
492- setRecipient ( '' )
493- setRecipientOpen ( false )
494505 await getOutputAmount ( {
495506 balance : toBN ( inputAmount || 0 , inputMintAcc . decimals ) ,
496507 } )
497508 }
498509 } ) ( )
499510 } , [
500511 getOutputAmount ,
512+ inputMint ,
501513 inputAmount ,
502514 inputMintAcc ,
515+ outputMint ,
503516 outputMintAcc ,
504517 isDevnet ,
505- setRecipient ,
506- setRecipientOpen ,
507518 ] )
508519
509520 const getInputAmount = useCallback (
You can’t perform that action at this time.
0 commit comments