fix(web): resolve post-rebase selector/store regressions
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: Cursor
This commit is contained in:
1 parent
4010fcfb63
commit
69a0b7f2ba
5 files changed
+7
-46
No files matched your search
@@ -48,13 +48,6 @@ export default function BranchToolbar({
|
||||
const setThreadBranchAction = useStore((store) => store.setThreadBranch);
|
||||
const setThreadErrorAction = useStore((store) => store.setError);
|
||||
const draftThread = useComposerDraftStore((store) => store.getDraftThread(threadId));
|
||||
const serverThread = useStore((state) =>
|
||||
state.threads.find((thread) => thread.id === threadId),
|
||||
);
|
||||
const activeProjectId = serverThread?.projectId ?? draftThread?.projectId ?? null;
|
||||
const activeProject = useStore((state) =>
|
||||
activeProjectId ? state.projects.find((project) => project.id === activeProjectId) : undefined,
|
||||
);
|
||||
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
@@ -475,15 +475,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
|
||||
const clearDraftThread = useComposerDraftStore((store) => store.clearDraftThread);
|
||||
const setDraftThreadContext = useComposerDraftStore((store) => store.setDraftThreadContext);
|
||||
const draftThread = useComposerDraftStore((store) => store.draftThreadsByThreadId[threadId] ?? null);
|
||||
const serverThread = useStore((state) =>
|
||||
state.threads.find((thread) => thread.id === threadId),
|
||||
);
|
||||
const fallbackDraftProjectId = draftThread?.projectId ?? null;
|
||||
const fallbackDraftProject = useStore((state) =>
|
||||
fallbackDraftProjectId
|
||||
? state.projects.find((project) => project.id === fallbackDraftProjectId)
|
||||
: undefined,
|
||||
);
|
||||
const promptRef = useRef(prompt);
|
||||
const [isDragOverComposer, setIsDragOverComposer] = useState(false);
|
||||
const [expandedImage, setExpandedImage] = useState<ExpandedImagePreview | null>(null);
|
||||
@@ -1714,7 +1705,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
|
||||
splitTerminal,
|
||||
keybindings,
|
||||
onToggleDiff,
|
||||
setThreadTerminalOpen,
|
||||
toggleTerminalVisibility,
|
||||
]);
|
||||
|
||||
|
||||
@@ -470,10 +470,11 @@ export default function Sidebar() {
|
||||
await handleNewThread(projectId).catch(() => undefined);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
setIsAddingProject(false);
|
||||
setNewCwd("");
|
||||
setAddingProject(false);
|
||||
}
|
||||
setIsAddingProject(false);
|
||||
setNewCwd("");
|
||||
setAddingProject(false);
|
||||
},
|
||||
[focusMostRecentThreadForProject, handleNewThread, isAddingProject, projects],
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ProjectId, ThreadId, TurnId } from "@t3tools/contracts";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { markThreadUnread, type AppState } from "./store";
|
||||
import type { Thread } from "./types";
|
||||
@@ -61,7 +61,7 @@ describe("store pure functions", () => {
|
||||
|
||||
const next = markThreadUnread(initialState, ThreadId.makeUnsafe("thread-1"));
|
||||
|
||||
const updatedThread = useStore.getState().threads[0];
|
||||
const updatedThread = next.threads[0];
|
||||
expect(updatedThread).toBeDefined();
|
||||
expect(updatedThread?.lastVisitedAt).toBe("2026-02-25T12:29:59.999Z");
|
||||
expect(Date.parse(updatedThread?.lastVisitedAt ?? "")).toBeLessThan(
|
||||
@@ -79,6 +79,6 @@ describe("store pure functions", () => {
|
||||
|
||||
const next = markThreadUnread(initialState, ThreadId.makeUnsafe("thread-1"));
|
||||
|
||||
expect(useStore.getState().threads[0]?.lastVisitedAt).toBe("2026-02-25T12:35:00.000Z");
|
||||
expect(next).toEqual(initialState);
|
||||
});
|
||||
});
|
||||
@@ -25,29 +25,6 @@ export interface AppState {
|
||||
runtimeMode: RuntimeMode;
|
||||
}
|
||||
|
||||
interface AppStore extends AppState {
|
||||
syncServerReadModel: (readModel: OrchestrationReadModel) => void;
|
||||
markThreadVisited: (threadId: ThreadId, visitedAt?: string) => void;
|
||||
markThreadUnread: (threadId: ThreadId) => void;
|
||||
toggleProject: (projectId: Project["id"]) => void;
|
||||
setThreadTerminalActivity: (
|
||||
threadId: ThreadId,
|
||||
terminalId: string,
|
||||
hasRunningSubprocess: boolean,
|
||||
) => void;
|
||||
setProjectExpanded: (projectId: Project["id"], expanded: boolean) => void;
|
||||
toggleThreadTerminal: (threadId: ThreadId) => void;
|
||||
setThreadTerminalOpen: (threadId: ThreadId, open: boolean) => void;
|
||||
setThreadTerminalHeight: (threadId: ThreadId, height: number) => void;
|
||||
splitThreadTerminal: (threadId: ThreadId, terminalId: string) => void;
|
||||
newThreadTerminal: (threadId: ThreadId, terminalId: string) => void;
|
||||
setThreadActiveTerminal: (threadId: ThreadId, terminalId: string) => void;
|
||||
closeThreadTerminal: (threadId: ThreadId, terminalId: string) => void;
|
||||
setThreadError: (threadId: ThreadId, error: string | null) => void;
|
||||
setThreadBranch: (threadId: ThreadId, branch: string | null, worktreePath: string | null) => void;
|
||||
setRuntimeMode: (mode: RuntimeMode) => void;
|
||||
}
|
||||
|
||||
const PERSISTED_STATE_KEY = "t3code:renderer-state:v7";
|
||||
const LEGACY_PERSISTED_STATE_KEYS = [
|
||||
"t3code:renderer-state:v6",
|
||||
|
||||
Reference in new issue
Block a user