Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(ui): redirect after org/project deletion when using custom base path (#4727)

Marc Klingenb37ec0348359
diff --git a/web/src/features/organizations/components/DeleteOrganizationButton.tsx b/web/src/features/organizations/components/DeleteOrganizationButton.tsx
index 13360d97d2..e48e95c0a0 100644
--- a/web/src/features/organizations/components/DeleteOrganizationButton.tsx
+++ b/web/src/features/organizations/components/DeleteOrganizationButton.tsx
@@ -23,6 +23,7 @@ import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePos
import { useQueryOrganization } from "@/src/features/organizations/hooks";
import { useHasOrganizationAccess } from "@/src/features/rbac/utils/checkOrganizationAccess";
import { showSuccessToast } from "@/src/features/notifications/showSuccessToast"; // Import success toast function
+import { env } from "@/src/env.mjs";
export function DeleteOrganizationButton() {
const capture = usePostHogClientCapture();
@@ -64,7 +65,7 @@ export function DeleteOrganizationButton() {
description: "The organization has been successfully deleted.",
});
await new Promise((resolve) => setTimeout(resolve, 5000)); // Delay for 5 seconds
- window.location.href = "/"; // Browser reload to refresh jwt
+ window.location.href = env.NEXT_PUBLIC_BASE_PATH ?? "/"; // Browser reload to refresh jwt
} catch (error) {
console.error(error);
}
diff --git a/web/src/features/projects/components/DeleteProjectButton.tsx b/web/src/features/projects/components/DeleteProjectButton.tsx
index 860784661f..5dc3c2c74b 100644
--- a/web/src/features/projects/components/DeleteProjectButton.tsx
+++ b/web/src/features/projects/components/DeleteProjectButton.tsx
@@ -22,6 +22,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { useQueryProject } from "@/src/features/projects/hooks";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
+import { env } from "@/src/env.mjs";
export function DeleteProjectButton() {
const capture = usePostHogClientCapture();
@@ -61,7 +62,7 @@ export function DeleteProjectButton() {
projectId: project.id,
})
.then(() => {
- window.location.href = "/"; // browser reload to refresh jwt
+ window.location.href = env.NEXT_PUBLIC_BASE_PATH ?? "/"; // browser reload to refresh jwt
})
.catch((error) => {
console.error(error);
@@ -77,7 +78,7 @@ export function DeleteProjectButton() {
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
- <DialogTitle className="text-lg font-semibold ">
+ <DialogTitle className="text-lg font-semibold">
Delete Project
</DialogTitle>
<DialogDescription className=" ">