Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(desktop): re-identify user on restart and reset on sign out
Richie McIlroy0df38e442976
diff --git a/apps/desktop/src/app.tsx b/apps/desktop/src/app.tsxindex be3971b4e..be56bd5ec 100644--- a/apps/desktop/src/app.tsx+++ b/apps/desktop/src/app.tsx@@ -22,8 +22,8 @@ import "./styles/theme.css";import { CapErrorBoundary } from "./components/CapErrorBoundary";import WindowChromeLayout from "./routes/(window-chrome)";import SettingsLayout from "./routes/(window-chrome)/settings";-import { generalSettingsStore } from "./store";-import { initAnonymousUser } from "./utils/analytics";+import { authStore, generalSettingsStore } from "./store";+import { identifyUser, initAnonymousUser } from "./utils/analytics";import { type AppTheme, commands } from "./utils/tauri";import titlebar from "./utils/titlebar-state";@@ -127,6 +127,11 @@ function Inner() {onMount(() => {initAnonymousUser();+ // OpenPanel keeps profileId in memory only (PostHog persisted it), so+ // sign-in-time identify alone loses attribution after an app restart.+ void authStore.get().then((auth) => {+ if (auth?.user_id) identifyUser(auth.user_id);+ });prewarmFontCaches();});diff --git a/apps/desktop/src/routes/(window-chrome)/settings.tsx b/apps/desktop/src/routes/(window-chrome)/settings.tsxindex 3a7a93609..ea3edf9dd 100644--- a/apps/desktop/src/routes/(window-chrome)/settings.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings.tsx@@ -22,7 +22,7 @@ import { CapErrorBoundary } from "~/components/CapErrorBoundary";import { SignInButton } from "~/components/SignInButton";import { authStore, userProfileStore } from "~/store";-import { trackEvent } from "~/utils/analytics";+import { resetUser, trackEvent } from "~/utils/analytics";import { createSignInMutation } from "~/utils/auth";import { commands } from "~/utils/tauri";import {@@ -149,6 +149,7 @@ export default function Settings(props: RouteSectionProps) {>(null);const clearLocalAuth = async () => {setAuth(undefined);+ resetUser();queryClient.removeQueries({ queryKey: ["settings-user-profile"] });await Promise.all([authStore.set(undefined),