mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
Merge conflict
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
"typescript": "^4.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blocksuite/blocks": "^0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/store": "^0.3.1-20230109032243-37ad3ba",
|
||||
"@blocksuite/blocks": "0.4.0-20230110112105-ef07332",
|
||||
"@blocksuite/store": "0.4.0-20230110112105-ef07332",
|
||||
"debug": "^4.3.4",
|
||||
"encoding": "^0.1.13",
|
||||
"firebase": "^9.15.0",
|
||||
|
||||
@@ -100,7 +100,8 @@ export class DataCenter {
|
||||
const workspace = createBlocksuiteWorkspace(workspaceMeta.id);
|
||||
|
||||
await this._mainProvider.createWorkspace(workspace, workspaceMeta);
|
||||
return workspace;
|
||||
const workspaceUnit = this._workspaceUnitCollection.find(workspaceMeta.id);
|
||||
return workspaceUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,18 +155,23 @@ export class DataCenter {
|
||||
* @returns {Promise<BlocksuiteWorkspace>}
|
||||
*/
|
||||
public async loadWorkspace(workspaceId: string) {
|
||||
const workspaceInfo = this._workspaceUnitCollection.find(workspaceId);
|
||||
assert(workspaceInfo, 'Workspace not found');
|
||||
const currentProvider = this.providerMap.get(workspaceInfo.provider);
|
||||
const workspaceUnit = this._workspaceUnitCollection.find(workspaceId);
|
||||
assert(workspaceUnit, 'Workspace not found');
|
||||
const currentProvider = this.providerMap.get(workspaceUnit.provider);
|
||||
if (currentProvider) {
|
||||
currentProvider.closeWorkspace(workspaceId);
|
||||
}
|
||||
const provider = this.providerMap.get(workspaceInfo.provider);
|
||||
assert(provider, `provide '${workspaceInfo.provider}' is not registered`);
|
||||
this._logger(`Loading ${workspaceInfo.provider} workspace: `, workspaceId);
|
||||
const provider = this.providerMap.get(workspaceUnit.provider);
|
||||
assert(provider, `provide '${workspaceUnit.provider}' is not registered`);
|
||||
this._logger(`Loading ${workspaceUnit.provider} workspace: `, workspaceId);
|
||||
const workspace = this._getBlocksuiteWorkspace(workspaceId);
|
||||
this._workspaceInstances.set(workspaceId, workspace);
|
||||
return await provider.warpWorkspace(workspace);
|
||||
await provider.warpWorkspace(workspace);
|
||||
this._workspaceUnitCollection.workspaces.forEach(workspaceUnit => {
|
||||
workspaceUnit.setBlocksuiteWorkspace(null);
|
||||
});
|
||||
workspaceUnit.setBlocksuiteWorkspace(workspace);
|
||||
return workspaceUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ export class WorkspaceUnit {
|
||||
public provider!: string;
|
||||
public syncMode: 'all' | 'core' = 'core';
|
||||
|
||||
private _blocksuiteWorkspace?: BlocksuiteWorkspace;
|
||||
private _blocksuiteWorkspace?: BlocksuiteWorkspace | null;
|
||||
|
||||
constructor(params: WorkspaceUnitCtorParams) {
|
||||
this.id = params.id;
|
||||
@@ -41,7 +41,7 @@ export class WorkspaceUnit {
|
||||
return this._blocksuiteWorkspace;
|
||||
}
|
||||
|
||||
setBlocksuiteWorkspace(blocksuiteWorkspace: BlocksuiteWorkspace) {
|
||||
setBlocksuiteWorkspace(blocksuiteWorkspace: BlocksuiteWorkspace | null) {
|
||||
if (blocksuiteWorkspace?.room !== this.id) {
|
||||
throw new Error('Workspace id inconsistent.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user