From fdedaa11231edfa86bb248fbe4ccdbe55acf14e0 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 12 Oct 2026 02:09:14 +0000 Subject: [PATCH] Refresh me on auth state so the admin entry survives reloads Why: store.me was only written by the forced-change gate's onDone (refreshMe sole caller), so after any page reload or a normal re-login me stayed null and the admin menu (me?.isAdmin gate in TaskSidebar/AdminZone) vanished permanently - reported repeatedly as the user-management page becoming unavailable. Evidence: vitest 100/100 pass and tsc+vite build clean after the change; grep shows refreshMe had exactly one call site before (App.tsx mustchange onDone). Impact: admins keep the system-management entry across reloads and normal logins; no behavior change for non-admins (me loads but isAdmin=false). Refs: dev task card feature/fe-me-refresh; companion Dev-repo pin bump. --- src/App.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index b253de0..ab4dffc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -68,6 +68,10 @@ export function App() { useEffect(() => { if (authState !== 'ok') return + // me 回填进 store:管理入口(me?.isAdmin)与侧栏身份都消费它;此前只有 + // 改密门 onDone 调 refreshMe,登录与刷新回态后 me 恒为 null,管理员菜单 + // 在任何一次 F5 后永久消失(2026-10-12「用户管理页面不可用」根因)。 + store.refreshMe() store.refreshProjects() store.refreshProfiles() store.refreshPlugins()