Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: userinfo issue after state refactor (#1061)

Peng Xiao13e2537dfb01
diff --git a/apps/web/src/store/app/datacenter/index.tsx b/apps/web/src/store/app/datacenter/index.tsx
index 3edd6d4bd5..d24c075bc8 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 a147ba3e02..8076a4ec88 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,
});