From 13e2537dfb0112da3f9cb6253c82447f9a99567d Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 16 Feb 2023 17:54:40 +0800 Subject: [PATCH] fix: userinfo issue after state refactor (#1061) --- apps/web/src/store/app/datacenter/index.tsx | 4 ++++ apps/web/src/store/app/user/index.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/apps/web/src/store/app/datacenter/index.tsx b/apps/web/src/store/app/datacenter/index.tsx index 3edd6d4bd..d24c075bc 100644 --- a/apps/web/src/store/app/datacenter/index.tsx +++ b/apps/web/src/store/app/datacenter/index.tsx @@ -128,6 +128,10 @@ export function DataCenterPreloader({ children }: React.PropsWithChildren) { currentWorkspace: null, currentDataCenterWorkspace: null, dataCenterPageList: [], + user: + (await dataCenter.getUserInfo( + dataCenter.providers.filter(p => p.id !== 'local')[0]?.id + )) || null, }); }); throw promise; diff --git a/apps/web/src/store/app/user/index.ts b/apps/web/src/store/app/user/index.ts index a147ba3e0..8076a4ec8 100644 --- a/apps/web/src/store/app/user/index.ts +++ b/apps/web/src/store/app/user/index.ts @@ -12,6 +12,7 @@ export interface UserActions { } export const createUserState = (): UserState => ({ + // initialized in DataCenterLoader (restore from localStorage) user: null, isOwner: false, });