Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Remove useStore selector compatibility shim

Julius Marminge410444aead74
diff --git a/apps/web/src/components/DiffPanel.tsx b/apps/web/src/components/DiffPanel.tsx
index 8a963c6e2..ed4559d3b 100644
--- a/apps/web/src/components/DiffPanel.tsx
+++ b/apps/web/src/components/DiffPanel.tsx
@@ -166,14 +166,15 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
select: (params) => (params.threadId ? ThreadId.makeUnsafe(params.threadId) : null),
});
const diffSearch = useSearch({ strict: false, select: (search) => parseDiffRouteSearch(search) });
+ const { state } = useStore();
const activeThreadId = routeThreadId;
- const activeThread = useStore((state) =>
- activeThreadId ? state.threads.find((thread) => thread.id === activeThreadId) : undefined,
- );
+ const activeThread = activeThreadId
+ ? state.threads.find((thread) => thread.id === activeThreadId)
+ : undefined;
const activeProjectId = activeThread?.projectId ?? null;
- const activeProject = useStore((state) =>
- activeProjectId ? state.projects.find((project) => project.id === activeProjectId) : undefined,
- );
+ const activeProject = activeProjectId
+ ? state.projects.find((project) => project.id === activeProjectId)
+ : undefined;
const activeCwd = activeThread?.worktreePath ?? activeProject?.cwd;
const { turnDiffSummaries, inferredCheckpointTurnCountByTurnId } =
useTurnDiffSummaries(activeThread);
diff --git a/apps/web/src/routes/_chat.$threadId.tsx b/apps/web/src/routes/_chat.$threadId.tsx
index ce8ec5aec..3cafa85ce 100644
--- a/apps/web/src/routes/_chat.$threadId.tsx
+++ b/apps/web/src/routes/_chat.$threadId.tsx
@@ -133,15 +133,14 @@ const DiffPanelInlineSidebar = (props: {
};
function ChatThreadRouteView() {
- const threadsHydrated = useStore((state) => state.threadsHydrated);
+ const { state } = useStore();
+ const threadsHydrated = state.threadsHydrated;
const navigate = useNavigate();
const threadId = Route.useParams({
select: (params) => ThreadId.makeUnsafe(params.threadId),
});
const search = Route.useSearch();
- const threadExists = useStore((state) =>
- state.threads.some((thread) => thread.id === threadId),
- );
+ const threadExists = state.threads.some((thread) => thread.id === threadId);
const draftThreadExists = useComposerDraftStore(
(store) => Object.hasOwn(store.draftThreadsByThreadId, threadId),
);
diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts
index 1b1bc9d28..c76309a60 100644
--- a/apps/web/src/store.ts
+++ b/apps/web/src/store.ts
@@ -432,7 +432,12 @@ export function StoreProvider({ children }: { children: ReactNode }) {
return createElement(Fragment, null, children);
}
-export function useStore() {
+type UseStoreCombinedResult = {
+ state: Pick<AppStore, "projects" | "threads" | "threadsHydrated" | "runtimeMode">;
+ dispatch: AppStore;
+};
+
+export function useStore(): UseStoreCombinedResult {
const state = useAppStore((s) => ({
projects: s.projects,
threads: s.threads,