Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix for "random" crash on creation

Daniel Hougaardebb8d632c400
diff --git a/frontend/src/layouts/AppLayout/AppLayout.tsx b/frontend/src/layouts/AppLayout/AppLayout.tsx
index 1cda2c6d7d..84dc0f480a 100644
--- a/frontend/src/layouts/AppLayout/AppLayout.tsx
+++ b/frontend/src/layouts/AppLayout/AppLayout.tsx
@@ -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");
diff --git a/frontend/src/pages/org/[id]/overview/index.tsx b/frontend/src/pages/org/[id]/overview/index.tsx
index 1b574611cd..8a703b3dcc 100644
--- a/frontend/src/pages/org/[id]/overview/index.tsx
+++ b/frontend/src/pages/org/[id]/overview/index.tsx
@@ -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);