Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

📈 Stop using bootstrap data

Luke Vella371510a9cde2
diff --git a/apps/web/src/app/[locale]/(space)/account/components/sign-out-button.tsx b/apps/web/src/app/[locale]/(space)/account/components/sign-out-button.tsx
index 922317059..cd80c0fe0 100644
--- a/apps/web/src/app/[locale]/(space)/account/components/sign-out-button.tsx
+++ b/apps/web/src/app/[locale]/(space)/account/components/sign-out-button.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@/components/trans";
import { usePostHog } from "@rallly/posthog/client";
import { Button } from "@rallly/ui/button";
import { Icon } from "@rallly/ui/icon";
-import Cookies from "js-cookie";
import { LogOutIcon } from "lucide-react";
import { signOut } from "next-auth/react";
-import { POSTHOG_BOOTSTAP_DATA_COOKIE_NAME } from "node_modules/@rallly/posthog/src/constants";
export const SignOutButton = () => {
const posthog = usePostHog();
@@ -17,7 +15,6 @@ export const SignOutButton = () => {
size="sm"
onClick={() => {
posthog?.reset();
- Cookies.remove(POSTHOG_BOOTSTAP_DATA_COOKIE_NAME);
signOut({
redirectTo: "/",
});
diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts
index 71a048d83..0a6933dc5 100644
--- a/apps/web/src/middleware.ts
+++ b/apps/web/src/middleware.ts
@@ -1,5 +1,4 @@
import { getPreferredLocale } from "@rallly/languages/get-preferred-locale";
-import { getPosthogBootstrapCookie } from "@rallly/posthog/utils";
import { NextResponse } from "next/server";
import { withAuth } from "@/auth/edge";
@@ -27,15 +26,6 @@ export const middleware = withAuth(async (req) => {
res.headers.set("x-locale", locale);
res.headers.set("x-pathname", pathname);
- if (req.auth?.user?.id) {
- const bootstrapCookie = getPosthogBootstrapCookie({
- distinctID: req.auth.user.id,
- });
- if (bootstrapCookie) {
- res.cookies.set(bootstrapCookie);
- }
- }
-
return res;
});
diff --git a/packages/posthog/src/client.tsx b/packages/posthog/src/client.tsx
index a5404432d..d6df3387b 100644
--- a/packages/posthog/src/client.tsx
+++ b/packages/posthog/src/client.tsx
@@ -1,23 +1,10 @@
"use client";
-import Cookies from "js-cookie";
import posthog from "posthog-js";
-import { POSTHOG_BOOTSTAP_DATA_COOKIE_NAME } from "./constants";
-
export { usePostHog } from "posthog-js/react";
import { PostHogProvider as BasePostHogProvider } from "posthog-js/react";
if (typeof window !== "undefined" && process.env.NEXT_PUBLIC_POSTHOG_API_KEY) {
- let bootstrapData = {};
- try {
- const cookieData = Cookies.get(POSTHOG_BOOTSTAP_DATA_COOKIE_NAME);
- if (cookieData) {
- bootstrapData = JSON.parse(cookieData);
- }
- } catch (error) {
- console.warn("Failed to parse PostHog bootstrap data:", error);
- }
-
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_API_KEY, {
debug: false,
api_host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST,
@@ -26,7 +13,6 @@ if (typeof window !== "undefined" && process.env.NEXT_PUBLIC_POSTHOG_API_KEY) {
disable_session_recording: true,
enable_heatmaps: false,
persistence: "cookie",
- bootstrap: bootstrapData,
autocapture: false,
opt_out_capturing_by_default: false,
cross_subdomain_cookie: true,