Skip to content

Commit

Permalink
fix: prevent sending a request for the same chain token combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Aug 19, 2024
1 parent 64c4547 commit 282bdf0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/widget/src/hooks/useRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
return { routes: [route] } as RoutesResponse;
}

// Prevent sending a request for the same chain token combinations.
if (fromChainId === toChainId && fromTokenAddress === toTokenAddress) {
return;
}

const data = await getRoutes(
{
fromAddress,
Expand Down

0 comments on commit 282bdf0

Please sign in to comment.