Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/hub/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ export const router = createRouter({
},
// Since we're using React Query, we don't want loader calls to ever be stale
// This will ensure that the loader is always called when the route is preloaded or visited
defaultPreload: "intent",
defaultStaleTime: Number.POSITIVE_INFINITY,
defaultPendingComponent: PageLayout.Root.Skeleton,
defaultPreloadStaleTime: 0,
defaultOnCatch: (error) => {
Sentry.captureException(error);
},
Expand Down
3 changes: 1 addition & 2 deletions apps/hub/src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SheetTrigger,
} from "@rivet-gg/components";
import { Icon, faBars } from "@rivet-gg/icons";
import { Link, useLocation } from "@tanstack/react-router";
import { Link } from "@tanstack/react-router";
import { Breadcrumbs } from "../breadcrumbs/breadcrumbs";
import { MobileBreadcrumbs } from "../breadcrumbs/mobile-breadcrumbs";
import { Changelog } from "./changelog";
Expand Down Expand Up @@ -36,7 +36,6 @@ const UserProfileButton = () => {
};

export function Header() {
const location = useLocation();
return (
<header className="bg-background/60 sticky top-0 z-10 flex items-center gap-4 border-b py-2 backdrop-blur">
<HeaderRouteLoader />
Expand Down
7 changes: 5 additions & 2 deletions apps/hub/src/lib/guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function guardEnterprise({
}
}

export async function guardOssNewie({
export async function guardOssNewbie({
queryClient,
auth,
}: { queryClient: QueryClient; auth: AuthContext }) {
Expand All @@ -55,14 +55,15 @@ export async function guardOssNewie({
projectId: projects[0].gameId,
environmentId: namespaces[0].namespaceId,
},
from: "/",
});
}

throw redirect({
to: "/projects/$projectId",
params: {
projectId: projects[0].gameId,
},
from: "/",
});
}

Expand All @@ -74,13 +75,15 @@ export async function guardOssNewie({
throw redirect({
to: "/teams/$groupId",
params: { groupId: lastTeam },
from: "/",
});
}

if (groups.length > 0) {
throw redirect({
to: "/teams/$groupId",
params: { groupId: groups[0].groupId },
from: "/",
});
}
}
7 changes: 4 additions & 3 deletions apps/hub/src/routes/_authenticated/_layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Intro } from "@/components/intro";
import { DeepDiveSection } from "@/components/sections/deep-dive-section";
import { FaqSection } from "@/components/sections/faq-section";
import { guardOssNewie } from "@/lib/guards";
import { guardOssNewbie } from "@/lib/guards";
import { H1, NarrowPage, Separator } from "@rivet-gg/components";
import { createFileRoute } from "@tanstack/react-router";
import { zodSearchValidator } from "@tanstack/router-zod-adapter";
Expand Down Expand Up @@ -35,10 +35,11 @@ const searchSchema = z.object({
export const Route = createFileRoute("/_authenticated/_layout/")({
validateSearch: zodSearchValidator(searchSchema),
component: IndexRoute,
beforeLoad: async ({ search, context: { queryClient, auth } }) => {
beforeLoad: ({ search, context: { queryClient, auth } }) => {
if (search.newbie === true) {
return;
}
await guardOssNewie({ queryClient, auth });
return guardOssNewbie({ queryClient, auth });
},
shouldReload: true,
});