Skip to content

Commit e2cb766

Browse files
t3dotggclaude
andcommitted
refactor(server): simplify linked-thread grouping in pull request sync query
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 7bc8ff0 commit e2cb766

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
808808
Request: Schema.Void,
809809
Result: ProjectionThreadPullRequestDbRowSchema.mapFields(
810810
Struct.assign({
811-
projectId: ProjectId,
811+
projectId: ProjectionThread.fields.projectId,
812812
settledOverride: ProjectionThread.fields.settledOverride,
813813
settledAt: ProjectionThread.fields.settledAt,
814814
}),
@@ -2828,18 +2828,15 @@ pending_approval_requests AS (
28282828
ProjectionThreadPullRequests & { readonly pullRequests: Array<ThreadPullRequestLink> }
28292829
>();
28302830
for (const row of rows) {
2831-
const thread = threads.get(row.threadId);
2832-
if (thread !== undefined) {
2833-
thread.pullRequests.push(mapPullRequestRow(row));
2834-
continue;
2835-
}
2836-
threads.set(row.threadId, {
2831+
const thread = threads.get(row.threadId) ?? {
28372832
id: row.threadId,
28382833
projectId: row.projectId,
28392834
settledOverride: row.settledOverride,
28402835
settledAt: row.settledAt,
2841-
pullRequests: [mapPullRequestRow(row)],
2842-
});
2836+
pullRequests: [],
2837+
};
2838+
thread.pullRequests.push(mapPullRequestRow(row));
2839+
threads.set(row.threadId, thread);
28432840
}
28442841
return [...threads.values()];
28452842
}),

0 commit comments

Comments
 (0)