Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(onboarding): replay focused guide after reset

Louis Beaumont51a64e24953d
diff --git a/apps/screenpipe-app-tauri/components/settings/general-settings.tsx b/apps/screenpipe-app-tauri/components/settings/general-settings.tsx
index 77db5da32..2dfca3a01 100644
--- a/apps/screenpipe-app-tauri/components/settings/general-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/general-settings.tsx
@@ -50,6 +50,9 @@ export default function GeneralSettings() {
const handleResetOnboarding = async () => {
setIsResettingOnboarding(true);
try {
+ // Reset the separately persisted popup-guide completion flag as part of
+ // the user's explicit request to replay the complete first run.
+ await updateSettings({ firstRunGuideDone: false });
await resetOnboarding();
const result = await commands.showOnboardingWindow();
if (result.status === "error") throw new Error(result.error);
diff --git a/apps/screenpipe-app-tauri/lib/hooks/__tests__/use-onboarding.test.ts b/apps/screenpipe-app-tauri/lib/hooks/__tests__/use-onboarding.test.ts
index 12b855d57..9ff479802 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/__tests__/use-onboarding.test.ts
+++ b/apps/screenpipe-app-tauri/lib/hooks/__tests__/use-onboarding.test.ts
@@ -139,7 +139,7 @@ describe("useOnboarding measurement", () => {
});
});
- it("keeps setup reset separate from the optional app tour", async () => {
+ it("replays the focused guide after an explicit onboarding reset", async () => {
mocks.resetOnboarding.mockResolvedValue({ status: "ok", data: null });
mocks.completeOnboarding.mockResolvedValue({ status: "ok", data: null });
localStorage.setItem("screenpipe:first-run-guide-pending", "true");
@@ -153,7 +153,7 @@ describe("useOnboarding measurement", () => {
localStorage.getItem(
"screenpipe:first-run-guide-replay-after-onboarding",
),
- ).toBeNull();
+ ).toBe("true");
await useOnboarding.getState().completeOnboarding({
method: "live_view_created",
@@ -167,8 +167,8 @@ describe("useOnboarding measurement", () => {
).toBeNull();
expect(
localStorage.getItem("screenpipe:first-run-guide-pending"),
- ).toBeNull();
- expect(mocks.emit).not.toHaveBeenCalledWith("first-run-guide-pending");
+ ).toBe("true");
+ expect(mocks.emit).toHaveBeenCalledWith("first-run-guide-pending");
expect(mocks.emit).toHaveBeenCalledWith("navigate", {
url: "screenpipe://home?section=brain",
});
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx
index 21faea655..c85b09320 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx
@@ -9,6 +9,7 @@ import { useEffect } from "react";
import posthog from "posthog-js";
import {
isFirstRunGuidePending,
+ isFirstRunGuideReplayAfterOnboarding,
setFirstRunGuidePending,
setFirstRunGuideReplayAfterOnboarding,
} from "@/lib/first-run-guide";
@@ -66,11 +67,13 @@ export const useOnboarding = create<OnboardingState>((set, get) => ({
completeOnboarding: async (context) => {
const firstRunGuideWasPending = isFirstRunGuidePending();
+ const replayFirstRunGuide = isFirstRunGuideReplayAfterOnboarding();
try {
set({ isLoading: true, error: null });
- // The old app tour competes with the user's chosen outcome. Brain now
- // owns activation; the generic tour remains explicit in Help.
- setFirstRunGuidePending(false);
+ // A deliberate Settings reset replays the focused popup guide, but the
+ // handoff is armed only as onboarding completes so it cannot appear on
+ // top of the setup window itself.
+ setFirstRunGuidePending(replayFirstRunGuide);
const result = await commands.completeOnboarding();
if (result.status === "ok") {
@@ -95,6 +98,13 @@ export const useOnboarding = create<OnboardingState>((set, get) => ({
? { goal_category: context.goalCategory }
: {}),
});
+ if (replayFirstRunGuide) {
+ try {
+ void emit("first-run-guide-pending").catch(() => {});
+ } catch {
+ // not in tauri (preview/tests)
+ }
+ }
// Rust routes a newly created Home to Brain. This covers a reused Home.
try {
void emit("navigate", {
@@ -123,9 +133,10 @@ export const useOnboarding = create<OnboardingState>((set, get) => ({
const result = await commands.resetOnboarding();
if (result.status === "ok") {
- // Reset setup without replaying the separate optional app tour.
+ // Resetting setup is an explicit request to replay the complete first
+ // run, including the focused guide after onboarding finishes.
setFirstRunGuidePending(false);
- setFirstRunGuideReplayAfterOnboarding(false);
+ setFirstRunGuideReplayAfterOnboarding(true);
// Update local state
set(state => ({
onboardingData: {