refactor: support suspense mode in workspaces (#1304)

This commit is contained in:
Himself65
2023-03-04 20:11:15 -06:00
committed by GitHub
parent dd6bee68cb
commit 9a199eb9a1
27 changed files with 713 additions and 652 deletions
+8 -2
View File
@@ -24,15 +24,21 @@ export function stringToColour(str: string) {
return colour;
}
const hashMap = new Map<string, BlockSuiteWorkspace>();
export const createEmptyBlockSuiteWorkspace = (
room: string,
blobOptionsGetter?: BlobOptionsGetter
) => {
return new BlockSuiteWorkspace({
): BlockSuiteWorkspace => {
if (hashMap.has(room)) {
return hashMap.get(room) as BlockSuiteWorkspace;
}
const workspace = new BlockSuiteWorkspace({
room,
isSSR: typeof window === 'undefined',
blobOptionsGetter,
})
.register(builtInSchemas)
.register(__unstableSchemas);
hashMap.set(room, workspace);
return workspace;
};