do not reset posthog users everytime someone is unauthenticated
This commit is contained in:
parent
6f0b811d67
commit
e3a231bba5
2 changed files with 6 additions and 3 deletions
|
|
@ -26,6 +26,11 @@ export default function ProfileMenu() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSignOut = () => {
|
||||||
|
if (posthog?.__loaded) posthog?.reset();
|
||||||
|
void signOut();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu as="div" className="relative inline-block text-left">
|
<Menu as="div" className="relative inline-block text-left">
|
||||||
<Menu.Button className="flex rounded-full bg-gray-800 text-sm focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800">
|
<Menu.Button className="flex rounded-full bg-gray-800 text-sm focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800">
|
||||||
|
|
@ -67,7 +72,7 @@ export default function ProfileMenu() {
|
||||||
<Menu.Item>
|
<Menu.Item>
|
||||||
{({ active }) => (
|
{({ active }) => (
|
||||||
<div
|
<div
|
||||||
onClick={() => void signOut()}
|
onClick={handleSignOut}
|
||||||
className={`mx-2 flex h-8 w-40 cursor-pointer flex-row content-center rounded-md p-2 ${
|
className={`mx-2 flex h-8 w-40 cursor-pointer flex-row content-center rounded-md p-2 ${
|
||||||
active ? "bg-gray-100" : ""
|
active ? "bg-gray-100" : ""
|
||||||
}`}
|
}`}
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ const PostHogIdentificationWrapper = ({
|
||||||
email,
|
email,
|
||||||
stripeSubscriptionStatus,
|
stripeSubscriptionStatus,
|
||||||
});
|
});
|
||||||
} else if (status === "unauthenticated") {
|
|
||||||
posthog?.reset();
|
|
||||||
}
|
}
|
||||||
}, [posthog, session, status]);
|
}, [posthog, session, status]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue