Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
✨ Add SessionRefresher to keep cookieCache warm in space layout (#2376)
Luke Vella742f91d4d684
diff --git a/apps/web/src/app/[locale]/(space)/layout.tsx b/apps/web/src/app/[locale]/(space)/layout.tsxindex 038bc7eca..953a27bef 100644--- a/apps/web/src/app/[locale]/(space)/layout.tsx+++ b/apps/web/src/app/[locale]/(space)/layout.tsx@@ -1,5 +1,6 @@import { dehydrate, HydrationBoundary } from "@tanstack/react-query";import { redirect } from "next/navigation";+import { SessionRefresher } from "@/components/session-refresher";import { PreferencesProvider } from "@/contexts/preferences";import { BillingProvider } from "@/features/billing/client";import { SpaceProvider } from "@/features/space/client";@@ -27,6 +28,7 @@ export default async function Layout({return (<HydrationBoundary state={dehydrate(helpers.queryClient)}>+ <SessionRefresher /><PreferencesProvider><SpaceProvider><BillingProvider>{children}</BillingProvider>diff --git a/apps/web/src/components/session-refresher.tsx b/apps/web/src/components/session-refresher.tsxnew file mode 100644index 000000000..67f1ed1a2--- /dev/null+++ b/apps/web/src/components/session-refresher.tsx@@ -0,0 +1,15 @@+"use client";++import { authClient } from "@/lib/auth-client";++// Fires /get-session on mount (and on tab focus, via better-auth defaults)+// so the cookieCache Set-Cookie reaches the browser. Without this, the+// session_data cookie only ever propagates at sign-in and every request+// past its 5-min lifetime falls back to a DB lookup.+//+// Only mount inside authenticated layouts — using this on public layouts+// would trigger a /get-session call for every anonymous poll viewer.+export function SessionRefresher() {+ authClient.useSession();+ return null;+}