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(core): make e2e more stable (#4987)

EYHN70e71bd43e3e
diff --git a/packages/frontend/core/src/pages/workspace/index.tsx b/packages/frontend/core/src/pages/workspace/index.tsx
index 5102ae3b0a..056f9acc84 100644
--- a/packages/frontend/core/src/pages/workspace/index.tsx
+++ b/packages/frontend/core/src/pages/workspace/index.tsx
@@ -43,15 +43,12 @@ export const loader: LoaderFunction = async args => {
if (!args.params.pageId) {
rootStore.set(currentPageIdAtom, null);
}
- if (currentMetadata.flavour === WorkspaceFlavour.AFFINE_CLOUD) {
- const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentMetadata.id);
- workspaceLoaderLogger.info('get cloud workspace atom');
+ const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentMetadata.id);
+ workspaceLoaderLogger.info('get cloud workspace atom');
- const workspace = await rootStore.get(workspaceAtom);
- if (!workspace.doc.isLoaded) {
- await workspace.doc.whenLoaded;
- }
- workspaceLoaderLogger.info('workspace loaded');
+ const workspace = await rootStore.get(workspaceAtom);
+ workspaceLoaderLogger.info('workspace loaded');
+ if (currentMetadata.flavour === WorkspaceFlavour.AFFINE_CLOUD) {
return (() => {
guidCompatibilityFix(workspace.doc);
const blockVersions = workspace.meta.blockVersions;
@@ -66,8 +63,6 @@ export const loader: LoaderFunction = async args => {
return false;
})();
}
-
- workspaceLoaderLogger.info('done');
return null;
};
diff --git a/packages/frontend/workspace/src/providers/index.ts b/packages/frontend/workspace/src/providers/index.ts
index a3f2b467e8..199521b4bf 100644
--- a/packages/frontend/workspace/src/providers/index.ts
+++ b/packages/frontend/workspace/src/providers/index.ts
@@ -59,7 +59,14 @@ export const createLocalProviders = (): DocProviderCreator[] => {
return engine.waitForLoadedRootDoc();
},
connect() {
- // TODO: actually connect
+ if (!connected) {
+ engine.start();
+
+ for (const provider of awarenessProviders) {
+ provider.connect();
+ }
+ connected = true;
+ }
},
disconnect() {
// TODO: actually disconnect
@@ -109,7 +116,14 @@ export const createAffineProviders = (): DocProviderCreator[] => {
return engine.waitForLoadedRootDoc();
},
connect() {
- // TODO: actually connect
+ if (!connected) {
+ engine.start();
+
+ for (const provider of awarenessProviders) {
+ provider.connect();
+ }
+ connected = true;
+ }
},
disconnect() {
// TODO: actually disconnect