Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(views): sort timeline entries after WebSocket append (#1047)

Bohan Jiang45dad230745f
diff --git a/packages/views/issues/hooks/use-issue-timeline.ts b/packages/views/issues/hooks/use-issue-timeline.ts
index dd1a339c2f..2ecd040120 100644
--- a/packages/views/issues/hooks/use-issue-timeline.ts
+++ b/packages/views/issues/hooks/use-issue-timeline.ts
@@ -70,7 +70,9 @@ export function useIssueTimeline(issueId: string, userId?: string) {
(old) => {
if (!old) return old;
if (old.some((e) => e.id === comment.id)) return old;
- return [...old, commentToTimelineEntry(comment)];
+ return [...old, commentToTimelineEntry(comment)].sort(
+ (a, b) => a.created_at.localeCompare(b.created_at),
+ );
},
);
},
@@ -144,7 +146,9 @@ export function useIssueTimeline(issueId: string, userId?: string) {
(old) => {
if (!old) return old;
if (old.some((e) => e.id === entry.id)) return old;
- return [...old, entry];
+ return [...old, entry].sort(
+ (a, b) => a.created_at.localeCompare(b.created_at),
+ );
},
);
},