flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/web/app/routes/not-found.tsx

22 lines793 bytesCodeBlame
1import { data } from "react-router";
2
3import type { Route } from "./+types/not-found";
4import { redirectIfRenamed } from "../lib/renamed.server";
5
6/**
7 * Any address no other route matches. Throwing the 404 from a route, rather
8 * than leaving the router to, means the root loader still runs, so someone
9 * signed in sees the page in their own sidebar and not the public frame.
10 *
11 * An address under a renamed workspace's old name is sent to the new one
12 * first, so deep links keep working the same as its pages do.
13 */
14export async function loader({ request }: Route.LoaderArgs) {
15 const first = new URL(request.url).pathname.split("/")[1];
16 if (first) await redirectIfRenamed(request, first);
17 throw data(null, { status: 404 });
18}
19
20export default function NotFound() {
21 return null;
22}