mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
Merge branch 'feat/datacenter' of https://github.com/toeverything/AFFiNE into feat/datacenter
This commit is contained in:
@@ -28,12 +28,9 @@ export const AppStateProvider = ({
|
|||||||
if (dataCenter.workspaces.length === 0) {
|
if (dataCenter.workspaces.length === 0) {
|
||||||
await createDefaultWorkspace(dataCenter);
|
await createDefaultWorkspace(dataCenter);
|
||||||
}
|
}
|
||||||
let currentWorkspace = appState.currentWorkspace;
|
const currentWorkspace = await dataCenter.loadWorkspace(
|
||||||
if (!currentWorkspace) {
|
dataCenter.workspaces[0].id
|
||||||
currentWorkspace = await dataCenter.loadWorkspace(
|
);
|
||||||
dataCenter.workspaces[0].id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const currentMetaWorkSpace = dataCenter.workspaces.find(item => {
|
const currentMetaWorkSpace = dataCenter.workspaces.find(item => {
|
||||||
return item.id === currentWorkspace.room;
|
return item.id === currentWorkspace.room;
|
||||||
});
|
});
|
||||||
@@ -53,7 +50,7 @@ export const AppStateProvider = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}, [appState.currentWorkspace]);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!appState?.currentWorkspace) {
|
if (!appState?.currentWorkspace) {
|
||||||
@@ -116,6 +113,9 @@ export const AppStateProvider = ({
|
|||||||
currentWorkspace: workspace,
|
currentWorkspace: workspace,
|
||||||
currentWorkspaceId: workspaceId,
|
currentWorkspaceId: workspaceId,
|
||||||
currentMetaWorkSpace: currentMetaWorkSpace ?? null,
|
currentMetaWorkSpace: currentMetaWorkSpace ?? null,
|
||||||
|
pageList: currentWorkspace.meta.pageMetas as PageMeta[],
|
||||||
|
currentPage: null,
|
||||||
|
editor: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
return workspace;
|
return workspace;
|
||||||
|
|||||||
Reference in New Issue
Block a user