Patch folder realtime threads locally
This commit is contained in:
@@ -5,6 +5,7 @@ import { subscribeBossEvents, type BossEventPayload } from "@/lib/boss-events";
|
||||
import {
|
||||
getAuditSummaryView,
|
||||
getConversationHomeItemForProject,
|
||||
getConversationThreadItemForProject,
|
||||
getConversationItems,
|
||||
getOpsSummaryView,
|
||||
} from "@/lib/boss-projections";
|
||||
@@ -31,6 +32,7 @@ async function buildEventPayload(event: string, payload: BossEventPayload) {
|
||||
return {
|
||||
...payload,
|
||||
conversationItem: getConversationHomeItemForProject(state, String(payload.projectId ?? "")),
|
||||
threadConversationItem: getConversationThreadItemForProject(state, String(payload.projectId ?? "")),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface BossEventPayload {
|
||||
status?: string;
|
||||
note?: string;
|
||||
conversationItem?: unknown;
|
||||
threadConversationItem?: unknown;
|
||||
}
|
||||
|
||||
type BossEventListener = (event: BossEventName, payload: BossEventPayload) => void;
|
||||
|
||||
@@ -671,6 +671,14 @@ export function getConversationHomeItemForProject(state: BossState, projectId: s
|
||||
);
|
||||
}
|
||||
|
||||
export function getConversationThreadItemForProject(state: BossState, projectId: string): ConversationItem | null {
|
||||
const normalizedProjectId = projectId.trim();
|
||||
if (!normalizedProjectId) {
|
||||
return null;
|
||||
}
|
||||
return getConversationItems(state).find((item) => item.projectId === normalizedProjectId) ?? null;
|
||||
}
|
||||
|
||||
export function getConversationFolderView(
|
||||
state: BossState,
|
||||
folderKey: string,
|
||||
|
||||
Reference in New Issue
Block a user