fix(infra): create template workspace with isolated nanoid (#4569)

This commit is contained in:
Alex Yang
2023-10-11 13:48:30 -05:00
committed by GitHub
parent 5be5863693
commit 491cd75fe0
10 changed files with 108 additions and 52 deletions

View File

@@ -1,5 +1,4 @@
import { DebugLogger } from '@affine/debug';
import { DEFAULT_HELLO_WORLD_PAGE_ID_SUFFIX } from '@affine/env/constant';
import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
import { Menu } from '@toeverything/components/menu';
import { getWorkspace } from '@toeverything/infra/__internal__/workspace';
@@ -32,10 +31,7 @@ export const loader: LoaderFunction = async () => {
const nonTrashPages = targetWorkspace.meta.pageMetas.filter(
({ trash }) => !trash
);
const helloWorldPage = nonTrashPages.find(
({ id, jumpOnce }) =>
id.endsWith(DEFAULT_HELLO_WORLD_PAGE_ID_SUFFIX) && jumpOnce
)?.id;
const helloWorldPage = nonTrashPages.find(({ jumpOnce }) => jumpOnce)?.id;
const pageId =
nonTrashPages.find(({ id }) => id === lastPageId)?.id ??
nonTrashPages.at(0)?.id;