mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-29 06:28:23 +02:00
Phase 1: Monorepo infrastructure - Add Turborepo with turbo.json pipeline (build, dev, typecheck, test) - Update pnpm-workspace.yaml to include packages/* - Create shared TypeScript config (packages/tsconfig) Phase 2: Extract packages/core (zero react-dom, all-platform reuse) - Move domain types, API client, logger, utils → packages/core/ - Move TanStack Query modules (issues, inbox, workspace, runtimes) - Move Zustand stores (auth, workspace, issues, navigation, modals) - Move realtime sync (WSProvider, hooks, ws-updaters) - Refactor auth/workspace stores to factory pattern for DI - Refactor ApiClient with onUnauthorized callback - Refactor useWorkspaceId to React Context (WorkspaceIdProvider) - Refactor WSProvider to accept wsUrl + store props - Create apps/web/platform/ bridge layer (api singleton, store instances) - Update 91 import paths across apps/web/ - Fix 3 test files for new import paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
880 B
TypeScript
31 lines
880 B
TypeScript
import type { QueryClient } from "@tanstack/react-query";
|
|
import { inboxKeys } from "./queries";
|
|
import type { InboxItem, IssueStatus } from "../types";
|
|
|
|
export function onInboxNew(
|
|
qc: QueryClient,
|
|
wsId: string,
|
|
_item: InboxItem,
|
|
) {
|
|
// Use invalidateQueries instead of setQueryData — triggers a refetch that
|
|
// reliably notifies all observers. The inbox list is small so this is cheap.
|
|
qc.invalidateQueries({ queryKey: inboxKeys.list(wsId) });
|
|
}
|
|
|
|
export function onInboxIssueStatusChanged(
|
|
qc: QueryClient,
|
|
wsId: string,
|
|
issueId: string,
|
|
status: IssueStatus,
|
|
) {
|
|
qc.setQueryData<InboxItem[]>(inboxKeys.list(wsId), (old) =>
|
|
old?.map((i) =>
|
|
i.issue_id === issueId ? { ...i, issue_status: status } : i,
|
|
),
|
|
);
|
|
}
|
|
|
|
export function onInboxInvalidate(qc: QueryClient, wsId: string) {
|
|
qc.invalidateQueries({ queryKey: inboxKeys.list(wsId) });
|
|
}
|