[go: up one dir, main page]

Skip to content

Commit

Permalink
refactor : improved performance, independent running promise in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosZoft committed Aug 6, 2022
1 parent fb81d1f commit 5528ed6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
13 changes: 5 additions & 8 deletions apps/ligo-virgo/src/pages/workspace/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ export function WorkspaceHome() {

useEffect(() => {
const navigate_to_user_initial_page = async () => {
const recent_pages = await services.api.userConfig.getRecentPages(
workspace_id,
user.id
);

const user_initial_page_id =
await services.api.userConfig.getUserInitialPage(
const [recent_pages, user_initial_page_id] = await Promise.all([
services.api.userConfig.getRecentPages(workspace_id, user.id),
services.api.userConfig.getUserInitialPage(
workspace_id,
user.id
);
),
]);
if (recent_pages.length === 0) {
await services.api.editorBlock.copyTemplateToPage(
workspace_id,
Expand Down
12 changes: 4 additions & 8 deletions apps/ligo-virgo/src/pages/workspace/docs/workspace-name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,11 @@ export const WorkspaceName = () => {
if (!currentSpaceId) {
return;
}

const name = await services.api.userConfig.getWorkspaceName(
currentSpaceId
);
const [name, workspaceId] = await Promise.all([
services.api.userConfig.getWorkspaceName(currentSpaceId),
services.api.userConfig.getWorkspaceId(currentSpaceId),
]);
setWorkspaceName(name);

const workspaceId = await services.api.userConfig.getWorkspaceId(
currentSpaceId
);
setWorkspaceId(workspaceId);
}, [currentSpaceId]);

Expand Down

0 comments on commit 5528ed6

Please sign in to comment.