mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
fix: user info not be revived after refresh (#1157)
This commit is contained in:
@@ -144,6 +144,17 @@ export function useDataCenterPublicWorkspace(workspaceId: string | null) {
|
||||
|
||||
export function DataCenterPreloader({ children }: React.PropsWithChildren) {
|
||||
const api = useGlobalStateApi();
|
||||
|
||||
// init user info from datacenter
|
||||
useEffect(() => {
|
||||
dataCenterPromise.then(async dataCenter => {
|
||||
const user = await dataCenter.getUserInfo();
|
||||
if (!api.getState().user) {
|
||||
api.setState({ user });
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
//# region effect for updating workspace page list
|
||||
useEffect(() => {
|
||||
return api.subscribe(
|
||||
|
||||
Reference in New Issue
Block a user