Skip to content

Commit

Permalink
CP-9343 Set initial tokens only once (#2010)
Browse files Browse the repository at this point in the history
  • Loading branch information
neven-s authored Oct 25, 2024
1 parent 04befa0 commit 9e10284
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core-mobile/app/screens/swap/SwapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ export default function SwapView(): JSX.Element {
useEffect(applyOptimalRateFx, [optimalRate])
useEffect(calculateMaxFx, [fromToken])
useEffect(() => {
if (params?.initialTokenIdFrom) {
if (!fromToken && params?.initialTokenIdFrom) {
const token = filteredTokenList.find(
tk => tk.localId === params.initialTokenIdFrom
)
if (token) {
setFromToken(token)
}
}
if (params?.initialTokenIdTo) {
if (!toToken && params?.initialTokenIdTo) {
const token = filteredTokenList.find(
tk => tk.localId === params.initialTokenIdTo
)
if (token) {
setToToken(token)
}
}
}, [params, filteredTokenList, setFromToken, setToToken])
}, [params, filteredTokenList, setFromToken, setToToken, fromToken, toToken])

function validateInputsFx(): void {
if (fromTokenValue && fromTokenValue.bn === 0n) {
Expand Down

0 comments on commit 9e10284

Please sign in to comment.