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(workspace): check session before get workspaces (#5621)

EYHN74a3a795bd1e
diff --git a/packages/frontend/workspace-impl/src/cloud/list.ts b/packages/frontend/workspace-impl/src/cloud/list.ts
index 26ffbed04c..03e04baf13 100644
--- a/packages/frontend/workspace-impl/src/cloud/list.ts
+++ b/packages/frontend/workspace-impl/src/cloud/list.ts
@@ -10,6 +10,7 @@ import { globalBlockSuiteSchema } from '@affine/workspace';
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
import { difference } from 'lodash-es';
import { nanoid } from 'nanoid';
+import { getSession } from 'next-auth/react';
import { applyUpdate, encodeStateAsUpdate } from 'yjs';
import { createLocalBlobStorage } from '../local/blob';
@@ -18,6 +19,10 @@ import { CLOUD_WORKSPACE_CHANGED_BROADCAST_CHANNEL_KEY } from './consts';
import { createAffineStaticStorage } from './sync';
async function getCloudWorkspaceList() {
+ const session = await getSession();
+ if (!session) {
+ return [];
+ }
try {
const { workspaces } = await fetcher({
query: getWorkspacesQuery,