Commit 6db58fae authored by Steven's avatar Steven

fix: prevent private memos from disappearing during token refresh (#5565)

Root cause: enabled={isInitialized && !!user} prevented displaying cached
data when user auth state transitioned during token refresh.

Changes:
- Remove !!user check from Home page enabled condition
- Add clearAccessToken() in redirectOnAuthFailure for clean logout

Fixes #5565
parent 8770b186
......@@ -28,7 +28,7 @@ const Home = () => {
listSort={listSort}
orderBy={orderBy}
filter={memoFilter}
enabled={isInitialized && !!user} // Wait for contexts to stabilize before fetching
enabled={isInitialized}
/>
</div>
);
......
import { clearAccessToken } from "@/auth-state";
import { getInstanceConfig } from "@/instance-config";
import { ROUTES } from "@/router/routes";
......@@ -31,6 +32,10 @@ export function redirectOnAuthFailure(): void {
// Only redirect if it's a private route or disallowPublicVisibility is enabled
if (disallowPublicVisibility || isPrivateRoute(currentPath)) {
// Clear access token to ensure user is fully logged out
// This prevents the issue where user appears logged in but sees only public memos
// See: https://github.com/usememos/memos/issues/5565
clearAccessToken();
window.location.replace(target);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment