Skip to content

Commit bb7a57a

Browse files
d-csclaude
andcommitted
fix(webapp): use redirectWithErrorMessage for project-not-found in runs loader
Match the convention used by every other dashboard route (batches, sessions, schedules): redirect to "/" with a toast on missing project, rather than rendering a bare 404. The environment-not-found branch remains a 404 via throwNotFound, since all peer routes for that case were previously broken (bare Error → 500) and are now consistent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 27b65fc commit bb7a57a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs._index/route.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { useOrganization } from "~/hooks/useOrganizations";
4040
import { useProject } from "~/hooks/useProject";
4141
import { useSearchParams } from "~/hooks/useSearchParam";
4242
import { useShortcutKeys } from "~/hooks/useShortcutKeys";
43+
import { redirectWithErrorMessage } from "~/models/message.server";
4344
import { findProjectBySlug } from "~/models/project.server";
4445
import { findEnvironmentBySlug } from "~/models/runtimeEnvironment.server";
4546
import { getRunFiltersFromRequest } from "~/presenters/RunFilters.server";
@@ -78,7 +79,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
7879

7980
const project = await findProjectBySlug(organizationSlug, projectParam, userId);
8081
if (!project) {
81-
throwNotFound("Project not found");
82+
return redirectWithErrorMessage("/", request, "Project not found");
8283
}
8384

8485
const environment = await findEnvironmentBySlug(project.id, envParam, userId);

0 commit comments

Comments
 (0)