From d76ef5bcb30bd87ea487894586978473fcc8fead Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Mon, 30 Mar 2026 09:12:54 -0400 Subject: [PATCH] fix(dashboard): use shared base time for connection timeline events Connection Timeline sidebar showed only one account because generateConnectionEvents() used per-account lastUsedAt as the base timestamp. Accounts with more recent lastUsedAt dominated the recency-sorted 100-event cap. Use the maximum lastUsedAt across all accounts so events interleave proportionally. Closes #856 --- ui/src/components/account/flow-viz/utils.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/src/components/account/flow-viz/utils.ts b/ui/src/components/account/flow-viz/utils.ts index ce101437..e6249006 100644 --- a/ui/src/components/account/flow-viz/utils.ts +++ b/ui/src/components/account/flow-viz/utils.ts @@ -44,8 +44,16 @@ export function formatTimelineTime(date: Date): string { export function generateConnectionEvents(accounts: AccountData[]): ConnectionEvent[] { const events: ConnectionEvent[] = []; + // Use a shared base time so events from all accounts interleave in the timeline. + // Without this, accounts with more recent lastUsedAt dominate the sorted output. + const now = Date.now(); + const sharedBaseTime = accounts.reduce((latest, a) => { + const t = a.lastUsedAt ? new Date(a.lastUsedAt).getTime() : now; + return Math.max(latest, isNaN(t) ? now : t); + }, now); + accounts.forEach((account) => { - const lastUsed = account.lastUsedAt ? new Date(account.lastUsedAt) : new Date(); + const lastUsed = new Date(sharedBaseTime); // Helper to add events const addEvents = (count: number, status: 'success' | 'failed') => {