From 282bdf046c01025b61057887613129647ad3d50d Mon Sep 17 00:00:00 2001 From: Eugene Chybisov Date: Mon, 19 Aug 2024 11:07:41 +0200 Subject: [PATCH] fix: prevent sending a request for the same chain token combinations --- packages/widget/src/hooks/useRoutes.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/widget/src/hooks/useRoutes.ts b/packages/widget/src/hooks/useRoutes.ts index 980ce8a06..c30c26722 100644 --- a/packages/widget/src/hooks/useRoutes.ts +++ b/packages/widget/src/hooks/useRoutes.ts @@ -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,