From a49d5ea1e2188956058e5e59c8468a147f5fa51a Mon Sep 17 00:00:00 2001 From: himself65 Date: Fri, 21 Apr 2023 13:45:23 -0500 Subject: [PATCH] fix(workspace): load first workspace in index page --- apps/web/src/pages/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsx index f5490b54d7..e7c7c705ab 100644 --- a/apps/web/src/pages/index.tsx +++ b/apps/web/src/pages/index.tsx @@ -1,5 +1,6 @@ import { DebugLogger } from '@affine/debug'; import { useTranslation } from '@affine/i18n'; +import { WorkspaceFlavour } from '@affine/workspace/type'; import type { NextPage } from 'next'; import { useRouter } from 'next/router'; import { Suspense, useEffect } from 'react'; @@ -26,7 +27,10 @@ const IndexPageInner = () => { const targetWorkspace = (lastWorkspaceId && workspaces.find(({ id }) => id === lastWorkspaceId)) || - workspaces.at(0); + // fixme(himself65): + // when affine workspace is expired and the first workspace is affine, + // the page will crash + workspaces.find(({ flavour }) => flavour === WorkspaceFlavour.LOCAL); if (targetWorkspace) { const pageId =