| author | |
| committer | |
| log | afcd824ae9ca93672fda317562e0076ce8918c89 |
| tree | fc9b116492b5a9625dde277e2c5eceee8550d887 |
| parent | f84f2797383fc6e586bb6e5d5b2eb18631152fb1 |
Remove duplicate selector declarations introduced during rebase and restore the streamlined AppStore shape so Zustand selector usage remains consistent.
Restore Sidebar cleanup semantics and pure store test assertions so lint/typecheck stay green after rebasing.
Made-with: Cursor5 files changed, 7 insertions(+), 46 deletions(-)
apps/web/src/components/BranchToolbar.tsx-7| ... | ... | @@ -48,13 +48,6 @@ export default function BranchToolbar({ |
| 48 | 48 | const setThreadBranchAction = useStore((store) => store.setThreadBranch); |
| 49 | 49 | const setThreadErrorAction = useStore((store) => store.setError); |
| 50 | 50 | const draftThread = useComposerDraftStore((store) => store.getDraftThread(threadId)); |
| 51 | const serverThread = useStore((state) => | |
| 52 | state.threads.find((thread) => thread.id === threadId), | |
| 53 | ); | |
| 54 | const activeProjectId = serverThread?.projectId ?? draftThread?.projectId ?? null; | |
| 55 | const activeProject = useStore((state) => | |
| 56 | activeProjectId ? state.projects.find((project) => project.id === activeProjectId) : undefined, | |
| 57 | ); | |
| 58 | 51 | const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext); |
| 59 | 52 | const queryClient = useQueryClient(); |
| 60 | 53 |
apps/web/src/components/ChatView.tsx-10| ... | ... | @@ -475,15 +475,6 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 475 | 475 | const clearDraftThread = useComposerDraftStore((store) => store.clearDraftThread); |
| 476 | 476 | const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext); |
| 477 | 477 | const draftThread = useComposerDraftStore((store) => store.draftThreadsByThreadId[threadId] ?? null); |
| 478 | const serverThread = useStore((state) => | |
| 479 | state.threads.find((thread) => thread.id === threadId), | |
| 480 | ); | |
| 481 | const fallbackDraftProjectId = draftThread?.projectId ?? null; | |
| 482 | const fallbackDraftProject = useStore((state) => | |
| 483 | fallbackDraftProjectId | |
| 484 | ? state.projects.find((project) => project.id === fallbackDraftProjectId) | |
| 485 | : undefined, | |
| 486 | ); | |
| 487 | 478 | const promptRef = useRef(prompt); |
| 488 | 479 | const [isDragOverComposer, setIsDragOverComposer] = useState(false); |
| 489 | 480 | const [expandedImage, setExpandedImage] = useState<ExpandedImagePreview | null>(null); |
| ... | ... | @@ -1714,7 +1705,6 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 1714 | 1705 | splitTerminal, |
| 1715 | 1706 | keybindings, |
| 1716 | 1707 | onToggleDiff, |
| 1717 | setThreadTerminalOpen, | |
| 1718 | 1708 | toggleTerminalVisibility, |
| 1719 | 1709 | ]); |
| 1720 | 1710 |
apps/web/src/components/Sidebar.tsx+4-3| ... | ... | @@ -470,10 +470,11 @@ export default function Sidebar() { |
| 470 | 470 | await handleNewThread(projectId).catch(() => undefined); |
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | } finally { | |
| 474 | setIsAddingProject(false); | |
| 475 | setNewCwd(""); | |
| 476 | setAddingProject(false); | |
| 473 | 477 | } |
| 474 | setIsAddingProject(false); | |
| 475 | setNewCwd(""); | |
| 476 | setAddingProject(false); | |
| 477 | 478 | }, |
| 478 | 479 | [focusMostRecentThreadForProject, handleNewThread, isAddingProject, projects], |
| 479 | 480 | ); |
apps/web/src/store.test.ts+3-3| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | import { ProjectId, ThreadId, TurnId } from "@t3tools/contracts"; |
| 2 | import { beforeEach, describe, expect, it } from "vitest"; | |
| 2 | import { describe, expect, it } from "vitest"; | |
| 3 | 3 | |
| 4 | 4 | import { markThreadUnread, type AppState } from "./store"; |
| 5 | 5 | import type { Thread } from "./types"; |
| ... | ... | @@ -61,7 +61,7 @@ describe("store pure functions", () => { |
| 61 | 61 | |
| 62 | 62 | const next = markThreadUnread(initialState, ThreadId.makeUnsafe("thread-1")); |
| 63 | 63 | |
| 64 | const updatedThread = useStore.getState().threads[0]; | |
| 64 | const updatedThread = next.threads[0]; | |
| 65 | 65 | expect(updatedThread).toBeDefined(); |
| 66 | 66 | expect(updatedThread?.lastVisitedAt).toBe("2026-02-25T12:29:59.999Z"); |
| 67 | 67 | expect(Date.parse(updatedThread?.lastVisitedAt ?? "")).toBeLessThan( |
| ... | ... | @@ -79,6 +79,6 @@ describe("store pure functions", () => { |
| 79 | 79 | |
| 80 | 80 | const next = markThreadUnread(initialState, ThreadId.makeUnsafe("thread-1")); |
| 81 | 81 | |
| 82 | expect(useStore.getState().threads[0]?.lastVisitedAt).toBe("2026-02-25T12:35:00.000Z"); | |
| 82 | expect(next).toEqual(initialState); | |
| 83 | 83 | }); |
| 84 | 84 | }); |
apps/web/src/store.ts-23| ... | ... | @@ -25,29 +25,6 @@ export interface AppState { |
| 25 | 25 | runtimeMode: RuntimeMode; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | interface AppStore extends AppState { | |
| 29 | syncServerReadModel: (readModel: OrchestrationReadModel) => void; | |
| 30 | markThreadVisited: (threadId: ThreadId, visitedAt?: string) => void; | |
| 31 | markThreadUnread: (threadId: ThreadId) => void; | |
| 32 | toggleProject: (projectId: Project["id"]) => void; | |
| 33 | setThreadTerminalActivity: ( | |
| 34 | threadId: ThreadId, | |
| 35 | terminalId: string, | |
| 36 | hasRunningSubprocess: boolean, | |
| 37 | ) => void; | |
| 38 | setProjectExpanded: (projectId: Project["id"], expanded: boolean) => void; | |
| 39 | toggleThreadTerminal: (threadId: ThreadId) => void; | |
| 40 | setThreadTerminalOpen: (threadId: ThreadId, open: boolean) => void; | |
| 41 | setThreadTerminalHeight: (threadId: ThreadId, height: number) => void; | |
| 42 | splitThreadTerminal: (threadId: ThreadId, terminalId: string) => void; | |
| 43 | newThreadTerminal: (threadId: ThreadId, terminalId: string) => void; | |
| 44 | setThreadActiveTerminal: (threadId: ThreadId, terminalId: string) => void; | |
| 45 | closeThreadTerminal: (threadId: ThreadId, terminalId: string) => void; | |
| 46 | setThreadError: (threadId: ThreadId, error: string | null) => void; | |
| 47 | setThreadBranch: (threadId: ThreadId, branch: string | null, worktreePath: string | null) => void; | |
| 48 | setRuntimeMode: (mode: RuntimeMode) => void; | |
| 49 | } | |
| 50 | ||
| 51 | 28 | const PERSISTED_STATE_KEY = "t3code:renderer-state:v7"; |
| 52 | 29 | const LEGACY_PERSISTED_STATE_KEYS = [ |
| 53 | 30 | "t3code:renderer-state:v6", |