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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): no bump-on-click, cross-view nav, "New chat" replaces Home
Louis Beaumont28c4b1ac508a
diff --git a/apps/screenpipe-app-tauri/app/home/page.tsx b/apps/screenpipe-app-tauri/app/home/page.tsxindex c75f310de..9a7ce9dd7 100644--- a/apps/screenpipe-app-tauri/app/home/page.tsx+++ b/apps/screenpipe-app-tauri/app/home/page.tsx@@ -7,7 +7,7 @@ import React, { useEffect, useState, useRef, Suspense, useCallback } from "reactimport {Settings as SettingsIcon,Workflow,- Home,+ Plus,Clock,Gift,HelpCircle,@@ -21,6 +21,8 @@ import {Phone,X,} from "lucide-react";+import { emit } from "@tauri-apps/api/event";+import { useChatStore } from "@/lib/stores/chat-store";import { useOverlayData } from "@/app/shortcut-reminder/use-overlay-data";import { cn } from "@/lib/utils";import { AppSidebar, SidebarProvider, useSidebarContext } from "@/components/app-sidebar";@@ -109,6 +111,31 @@ function HomeContent() {void mountPiEventRouter();}, []);+ // Selecting a chat from the sidebar (or any other source that emits+ // chat-load-conversation) should also FLIP the active view to the chat+ // panel. Without this, clicking a chat from the Pipes / Timeline /+ // Memories views appears to "do nothing" — the standalone chat+ // component receives the event and switches conversation just fine,+ // but the user is still looking at a different view. They'd have to+ // also click "New chat" or similar to see the result. Hooking the+ // listener at the page level fixes the cross-view UX.+ useEffect(() => {+ let unlistenFn: (() => void) | undefined;+ let cancelled = false;+ (async () => {+ const { listen } = await import("@tauri-apps/api/event");+ const u = await listen("chat-load-conversation", () => {+ if (cancelled) return;+ setActiveSection("home");+ });+ unlistenFn = u;+ })();+ return () => {+ cancelled = true;+ unlistenFn?.();+ };+ }, [setActiveSection]);+// Sidebar collapse state (persisted in localStorage)const [sidebarCollapsed, setSidebarCollapsed] = useState(false);const [teamPromoDismissed, setTeamPromoDismissed] = useState(false);@@ -322,7 +349,11 @@ function HomeContent() {// Top-level nav items (filtered by enterprise policy)const mainSections = [- { id: "home", label: "Home", icon: <Home className="h-3.5 w-3.5" /> },+ // The first nav item doubles as "go to chat view + start a fresh+ // conversation". Replaces the old "Home" + the "+" inside the chat+ // sidebar (single, obvious entry point). The click handler below+ // both switches the active section AND spins up a new chat session.+ { id: "home", label: "New chat", icon: <Plus className="h-3.5 w-3.5" /> },{ id: "pipes", label: "Pipes", icon: <Workflow className="h-3.5 w-3.5" /> },{ id: "timeline", label: "Timeline", icon: <Clock className="h-3.5 w-3.5" /> },{ id: "memories", label: "Memories", icon: <Sparkles className="h-3.5 w-3.5" /> },@@ -483,6 +514,29 @@ function HomeContent() {data-testid={`nav-${section.id}`}onClick={() => {setActiveSection(section.id);+ // The "home" slot is the New Chat affordance —+ // clicking it (from any view) spawns a fresh+ // chat session and switches to it. Mirrors the+ // sidebar's "+ new chat" behaviour exactly so+ // the two entry points stay in sync.+ if (section.id === "home") {+ const id = crypto.randomUUID();+ const store = useChatStore.getState();+ store.actions.upsert({+ id,+ title: "new chat",+ preview: "",+ status: "idle",+ messageCount: 0,+ updatedAt: Date.now(),+ pinned: false,+ unread: false,+ });+ store.actions.setCurrent(id);+ void emit("chat-load-conversation", {+ conversationId: id,+ });+ }}}className={cn("w-full flex items-center px-2.5 py-1.5 rounded-lg transition-all duration-150 text-left group",diff --git a/apps/screenpipe-app-tauri/components/chat-sidebar.tsx b/apps/screenpipe-app-tauri/components/chat-sidebar.tsxindex 2f656e141..7b9f142b6 100644--- a/apps/screenpipe-app-tauri/components/chat-sidebar.tsx+++ b/apps/screenpipe-app-tauri/components/chat-sidebar.tsx@@ -32,7 +32,7 @@*/import React, { useEffect, useMemo } from "react";-import { Plus, Pin, X, AlertCircle } from "lucide-react";+import { Pin, X, AlertCircle } from "lucide-react";import { emit, listen } from "@tauri-apps/api/event";import { cn } from "@/lib/utils";import {@@ -198,22 +198,10 @@ export function ChatSidebar({ className }: ChatSidebarProps) {</Section>)}- <Section- title="recents"- action={- <button- onClick={handleNew}- className={cn(- "p-1 rounded hover:bg-muted/60 transition-colors",- "text-muted-foreground hover:text-foreground"- )}- title="new chat"- data-testid="chat-sidebar-new"- >- <Plus className="h-3.5 w-3.5" />- </button>- }- >+ {/* No "+" action here — the "New chat" item in the main nav+ (top of the sidebar) is the single new-conversation entry+ point. Two affordances for the same thing was confusing. */}+ <Section title="recents">{recents.length === 0 && pinned.length === 0 ? (<div className="px-3 py-2 text-xs text-muted-foreground/70 italic">no chats yet — click + to startdiff --git a/apps/screenpipe-app-tauri/lib/stores/chat-store.ts b/apps/screenpipe-app-tauri/lib/stores/chat-store.tsindex 659d184a5..8c8d9a15b 100644--- a/apps/screenpipe-app-tauri/lib/stores/chat-store.ts+++ b/apps/screenpipe-app-tauri/lib/stores/chat-store.ts@@ -274,7 +274,13 @@ export const useChatStore = create<ChatStore>((set) => ({...existing,messages,messageCount: messages.length,- updatedAt: Date.now(),+ // NOTE: no updatedAt bump. setMessages is called both for+ // genuine activity (new user message, agent_end) AND for+ // hydration on session switch. Bumping here would re-sort+ // the sidebar every time the user just CLICKS a row,+ // which is wrong — clicking should not change ordering.+ // Callers that represent real activity (appendMessage,+ // setStreaming) bump updatedAt themselves.},},};@@ -327,7 +333,11 @@ export const useChatStore = create<ChatStore>((set) => ({return {sessions: {...s.sessions,- [id]: { ...existing, ...state, updatedAt: Date.now() },+ // No updatedAt bump — same reasoning as setMessages.+ // setStreaming is called for snapshot-on-switch (not new+ // activity) AND for genuine streaming deltas. The router+ // still bumps via patchMessage for the latter.+ [id]: { ...existing, ...state },},};}),diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.tomlindex a18383034..b81ffd81c 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "2.4.62"+version = "2.4.63"description = "24/7 memory for your desktop. 100% local."authors = ["you"]license = ""