From d98e36baffd8cb590e158d4f343b790048cf55ed Mon Sep 17 00:00:00 2001 From: Satya Patel Date: Fri, 1 May 2026 16:06:26 -0700 Subject: [PATCH] fix(desktop): keep createdAt tiebreaker stable when sorting v2 workspaces The within-host createdAt order was being flipped by the host sort direction toggle. Apply the directional flip to the primary field only, then always use newest-first createdAt as the tiebreaker. --- .../components/V2WorkspacesList/V2WorkspacesList.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx index 521e0a49afb..0adb0f7ce65 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspaces/components/V2WorkspacesList/V2WorkspacesList.tsx @@ -74,10 +74,9 @@ function compareWorkspaces( cmp = a.createdAt.getTime() - b.createdAt.getTime(); break; } - if (cmp === 0) { - cmp = b.createdAt.getTime() - a.createdAt.getTime(); - } - return direction === "asc" ? cmp : -cmp; + const directional = direction === "asc" ? cmp : -cmp; + if (directional !== 0) return directional; + return b.createdAt.getTime() - a.createdAt.getTime(); } function groupByProject(