mirror of https://github.com/langgenius/dify.git
tweaks
This commit is contained in:
parent
4dc965aebf
commit
b1ff105e8c
|
|
@ -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', () => {
|
|||
</RoleRouteGuard>
|
||||
))
|
||||
|
||||
expect(screen.getByTestId('guarded-content')).toBeInTheDocument()
|
||||
expect(screen.queryByTestId('guarded-content')).not.toBeInTheDocument()
|
||||
expect(mockReplace).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue