Skip to content

Commit

Permalink
[Redesign] Automatic route selection should overwrite invalid routes (#…
Browse files Browse the repository at this point in the history
…2687)

Signed-off-by: Emre Bogazliyanlioglu <emre@wormholelabs.xyz>
  • Loading branch information
emreboga authored Sep 20, 2024
1 parent 096f4d4 commit 6dbc1f1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wormhole-connect/src/views/v2/Bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,14 @@ const Bridge = () => {
setSelectedRoute('');
} else {
const autoselectedRoute = route || validRoutes[0].route.name;
const isSelectedRouteValid =
validRoutes.findIndex((r) => r.route.name === selectedRoute) > -1;

// avoids overwriting selected route
if (!autoselectedRoute || !!selectedRoute) return;
// If no route is autoselected or we already have a valid selected route,
// we should avoid to overwrite it
if (!autoselectedRoute || (selectedRoute && isSelectedRouteValid)) {
return;
}

const routeData = validRoutes?.find(
(rs) => rs.route.name === autoselectedRoute,
Expand Down

0 comments on commit 6dbc1f1

Please sign in to comment.