From b1ff105e8c72f5216b996a1642da78ee316ce17a Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Thu, 19 Mar 2026 11:28:28 +0800 Subject: [PATCH] tweaks --- web/app/(commonLayout)/role-route-guard.spec.tsx | 4 ++-- web/app/(commonLayout)/role-route-guard.tsx | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/(commonLayout)/role-route-guard.spec.tsx b/web/app/(commonLayout)/role-route-guard.spec.tsx index 46138a990f..1f66bd203b 100644 --- a/web/app/(commonLayout)/role-route-guard.spec.tsx +++ b/web/app/(commonLayout)/role-route-guard.spec.tsx @@ -41,7 +41,7 @@ describe('RoleRouteGuard', () => { setAppContext() }) - it('should keep rendering children while workspace is loading', () => { + it('should hide guarded content while workspace is loading', () => { setAppContext({ isLoadingCurrentWorkspace: true, }) @@ -52,7 +52,7 @@ describe('RoleRouteGuard', () => { )) - expect(screen.getByTestId('guarded-content')).toBeInTheDocument() + expect(screen.queryByTestId('guarded-content')).not.toBeInTheDocument() expect(mockReplace).not.toHaveBeenCalled() }) diff --git a/web/app/(commonLayout)/role-route-guard.tsx b/web/app/(commonLayout)/role-route-guard.tsx index 591a494058..4b6acb3569 100644 --- a/web/app/(commonLayout)/role-route-guard.tsx +++ b/web/app/(commonLayout)/role-route-guard.tsx @@ -21,6 +21,9 @@ export default function RoleRouteGuard({ children }: { children: ReactNode }) { router.replace('/datasets') }, [shouldRedirect, router]) + if (shouldGuardRoute && isLoadingCurrentWorkspace) + return null + if (shouldRedirect) return null