Skip to content

Commit 4abafd3

Browse files
committed
Fix coalescing text semantics for non-streaming events and remove unused useThreadIdsByProjectId hook
- In coalesceOrchestrationUiEvents, when the later event has streaming=false and non-empty text, use the later event's text as a replacement instead of concatenating, matching the store handler's replacement semantics. - Remove unused useThreadIdsByProjectId hook and its selectThreadIdsByProjectId import from storeSelectors.ts.
1 parent 37d6208 commit 4abafd3

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

apps/web/src/routes/__root.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ function coalesceOrchestrationUiEvents(
175175
...event.payload,
176176
attachments: event.payload.attachments ?? previous.payload.attachments,
177177
createdAt: previous.payload.createdAt,
178-
text: previous.payload.text + event.payload.text,
178+
text:
179+
!event.payload.streaming && event.payload.text.length > 0
180+
? event.payload.text
181+
: previous.payload.text + event.payload.text,
179182
},
180183
};
181184
continue;

apps/web/src/storeSelectors.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { type ProjectId, type ThreadId } from "@t3tools/contracts";
1+
import { type ThreadId } from "@t3tools/contracts";
22
import { useMemo } from "react";
33
import {
44
selectProjectById,
55
selectSidebarThreadSummaryById,
66
selectThreadById,
7-
selectThreadIdsByProjectId,
87
useStore,
98
} from "./store";
109
import { type Project, type SidebarThreadSummary, type Thread } from "./types";
@@ -25,8 +24,3 @@ export function useSidebarThreadSummaryById(
2524
const selector = useMemo(() => selectSidebarThreadSummaryById(threadId), [threadId]);
2625
return useStore(selector);
2726
}
28-
29-
export function useThreadIdsByProjectId(projectId: ProjectId | null | undefined): ThreadId[] {
30-
const selector = useMemo(() => selectThreadIdsByProjectId(projectId), [projectId]);
31-
return useStore(selector);
32-
}

0 commit comments

Comments
 (0)