Derive newThreadTarget from the full thread history, not search matches
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
542ce60b9e
commit
61ebadb99f
1 file changed
+9
-6
@@ -216,12 +216,15 @@ export function buildHomeThreadGroups(input: {
|
||||
: sortedThreads;
|
||||
|
||||
// Sorted newest-first, so the first thread whose project is a group member
|
||||
// marks the machine the user last worked on.
|
||||
const lastActiveProject = Arr.findFirst(sortedThreads, (thread) =>
|
||||
group.projects.some(
|
||||
(project) =>
|
||||
project.environmentId === thread.environmentId && project.id === thread.projectId,
|
||||
),
|
||||
// marks the machine the user last worked on. Derived from the FULL history
|
||||
// (not the search-filtered subset) so the target is stable across queries.
|
||||
const lastActiveProject = Arr.findFirst(
|
||||
sortThreads(group.threads, input.threadSortOrder),
|
||||
(thread) =>
|
||||
group.projects.some(
|
||||
(project) =>
|
||||
project.environmentId === thread.environmentId && project.id === thread.projectId,
|
||||
),
|
||||
).pipe(
|
||||
Option.flatMap((thread) =>
|
||||
Arr.findFirst(
|
||||
|
||||
Reference in new issue
Block a user