From aaca0798e3db322a470ced71f6e850edf6ecd651 Mon Sep 17 00:00:00 2001 From: tzhangchi Date: Thu, 8 Sep 2022 15:43:55 +0800 Subject: [PATCH] feat(route): rename variables --- apps/ligo-virgo/src/pages/workspace/Home.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/ligo-virgo/src/pages/workspace/Home.tsx b/apps/ligo-virgo/src/pages/workspace/Home.tsx index 3ae0da1da5..1d6e0fb661 100644 --- a/apps/ligo-virgo/src/pages/workspace/Home.tsx +++ b/apps/ligo-virgo/src/pages/workspace/Home.tsx @@ -9,18 +9,19 @@ export function WorkspaceHome() { const { user } = useUserAndSpaces(); useEffect(() => { - const navigate_to_user_initial_page = async () => { - const [recent_pages, user_initial_page_id] = await Promise.all([ + const navigateToUserInitialPage = async () => { + const [recentPages, userInitialPageId] = await Promise.all([ services.api.userConfig.getRecentPages(workspace_id, user.id), services.api.userConfig.getUserInitialPage( workspace_id, user.id ), ]); - if (recent_pages.length === 0) { + // if recent pages if null, run initialize task + if (recentPages.length === 0) { await services.api.editorBlock.copyTemplateToPage( workspace_id, - user_initial_page_id, + userInitialPageId, TemplateFactory.generatePageTemplateByGroupKeys({ name: '👋 Get Started with AFFiNE', groupKeys: [ @@ -31,10 +32,11 @@ export function WorkspaceHome() { }) ); } - - navigate(`/${workspace_id}/${user_initial_page_id}`); + if (userInitialPageId) { + navigate(`/${workspace_id}/${userInitialPageId}`); + } }; - navigate_to_user_initial_page(); + navigateToUserInitialPage(); }, [navigate, user.id, workspace_id]); return null;