Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#9354] fix(web): fix redirect metalake issue (#9355)

Qian Xia3646cdf2d095
diff --git a/web/web/src/lib/provider/session.js b/web/web/src/lib/provider/session.js
index 652de1e8fd..ebd9df1575 100644
--- a/web/web/src/lib/provider/session.js
+++ b/web/web/src/lib/provider/session.js
@@ -66,20 +66,19 @@ const AuthProvider = ({ children }) => {
const goToMetalakeListPage = () => {
try {
- const pathname = window.location.pathname
- const doneFlag = sessionStorage.getItem('authInitDone')
+ let pathname = window.location.pathname
- if (!doneFlag) {
- sessionStorage.setItem('authInitDone', 'true')
-
- if (pathname === '/' || pathname === '/ui' || pathname === '/ui/') {
- router.replace('/metalakes')
- } else {
- router.replace(pathname + window.location.search)
- }
+ // Remove /ui prefix since Next.js basePath will add it automatically
+ if (pathname.startsWith('/ui')) {
+ pathname = pathname.slice(3) || '/'
+ }
+ if (pathname === '/' || pathname === '') {
+ router.replace('/metalakes')
+ } else {
+ router.replace(pathname + window.location.search)
}
} catch (e) {
- router.push('/metalakes')
+ router.replace('/metalakes')
}
}