ai-yang opened a new issue, #714:
URL: https://github.com/apache/rocketmq-dashboard/issues/714
## Affected branch
`rocketmq-studio` at `bbf1b7e0cf25a5065ba049b5450cc8155569f710`
## Description
`MainLayout.handleUserMenuClick` clears the local authentication session
after logout and then navigates to `/`. However, `/` is itself a protected
child route under the already-mounted `AuthGate`.
`AuthGate` keeps its current `allowed` state while that route subtree
remains mounted; clearing the Zustand session does not re-run its status-check
effect. As a result, a user who logs out from a protected page is sent to the
protected home page instead of the login page. The same behavior occurs when
the server-side logout request fails because local cleanup and navigation run
in `finally`.
## Deterministic reproduction
1. Start with an authenticated session on `/instance/topic`.
2. Trigger the user-menu logout action.
3. Let the logout request complete.
4. Observe the rendered route.
A `MemoryRouter` regression test fixes this exact sequence. On the
unmodified branch, the test failed 5/5 times because the login route was never
rendered and the protected home route remained accessible in the mounted tree.
## Expected behavior
After the local session is cleared, logout should navigate directly to
`/login` with history replacement so that the protected route is unmounted and
the browser Back action does not restore it.
## Proposed fix and validation
Replace the post-logout navigation with `navigate('/login', { replace: true
})` and cover the complete login-to-logout route transition.
The regression test passes 20/20 with that change. The complete Node 20
frontend gates also pass:
- 64 Vitest files / 266 tests
- ESLint: 0 errors (4 existing Fast Refresh warnings)
- Production build
This change does not alter any API or server-side authentication contract.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]