From b07800ae08a4b982191d11f2f0250f57622ec348 Mon Sep 17 00:00:00 2001
From: Alunara <>
Date: Tue, 28 Jan 2025 22:57:25 +0100
Subject: [PATCH] fix: broken dex link when not on dex app
---
apps/main/src/pages/dex.tsx | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/apps/main/src/pages/dex.tsx b/apps/main/src/pages/dex.tsx
index 7a149e62e..25c21f257 100644
--- a/apps/main/src/pages/dex.tsx
+++ b/apps/main/src/pages/dex.tsx
@@ -1,6 +1,6 @@
import type { NextPage } from 'next'
import dynamic from 'next/dynamic'
-import { Navigate, Route, Routes } from 'react-router'
+import { Navigate, Route, Routes, useParams } from 'react-router'
import { REFRESH_INTERVAL, ROUTE } from '@/dex/constants'
import 'focus-visible'
import { i18n } from '@lingui/core'
@@ -158,9 +158,19 @@ const App: NextPage = () => {
isPageVisible,
)
+ /**
+ * Lazily use useParams() to preserve network parameter during redirects.
+ * Using Navigate instead of direct component rendering ensures proper
+ * menu highlighting via isActive state.
+ */
+ const RootRedirect = () => {
+ const { network } = useParams()
+ return
+ }
+
const SubRoutes = (
<>
- } />
+ } />
} />
} />
} />