Skip to content

Commit

Permalink
Fix for "random" crash on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Feb 14, 2024
1 parent ae4fa7e commit 9ab242e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions frontend/src/layouts/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ export const AppLayout = ({ children }: LayoutProps) => {
projectId: newProjectId
});
}

// eslint-disable-next-line no-promise-executor-return -- We do this because the function returns too fast, which sometimes causes an error when the user is redirected.
await new Promise((resolve) => setTimeout(resolve, 2_000));

createNotification({ text: "Workspace created", type: "success" });
handlePopUpClose("addNewWs");
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/org/[id]/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,11 @@ const OrganizationPage = withPermission(
});
}

createNotification({ text: "Workspace created", type: "success" });
// eslint-disable-next-line no-promise-executor-return -- We do this because the function returns too fast, which sometimes causes an error when the user is redirected.
await new Promise((resolve) => setTimeout(resolve, 2_000));

handlePopUpClose("addNewWs");
createNotification({ text: "Workspace created", type: "success" });
router.push(`/project/${newProjectId}/secrets/overview`);
} catch (err) {
console.error(err);
Expand Down

0 comments on commit 9ab242e

Please sign in to comment.