Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix: max age on ui cookies

Carl-Gerhard Lindesvärde505c0ea4511
diff --git a/apps/start/src/hooks/use-cookie-store.tsx b/apps/start/src/hooks/use-cookie-store.tsx
index e3717b0e4..5bb383fc5 100644
--- a/apps/start/src/hooks/use-cookie-store.tsx
+++ b/apps/start/src/hooks/use-cookie-store.tsx
@@ -19,7 +19,12 @@ const setCookieFn = createServerFn({ method: 'POST' })
if (!VALID_COOKIES.includes(key)) {
return;
}
- setCookie(key, value);
+ const maxAge = 60 * 60 * 24 * 365 * 10;
+ setCookie(key, value, {
+ maxAge,
+ path: '/',
+ expires: new Date(Date.now() + maxAge),
+ });
});
// Called in __root.tsx beforeLoad hook to get cookies from the server