Skip to content

Commit da02b7c

Browse files
Device details page: agent order device tab (#2004)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7a02b44 commit da02b7c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

  • openframe/services/openframe-frontend/src/app/(app)/devices/components/tabs

openframe/services/openframe-frontend/src/app/(app)/devices/components/tabs/agents-tab.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,11 @@ export function AgentsTab({ device }: AgentsTabProps) {
104104
}
105105
});
106106

107-
// Sort agents to show those with agentToolId first
108-
combinedAgents.sort((a, b) => {
109-
if (a.agentToolId && !b.agentToolId) return -1;
110-
if (!a.agentToolId && b.agentToolId) return 1;
111-
return 0;
112-
});
107+
// Sort agents alphabetically by agentType for a stable, predictable order across reloads.
108+
// Tie-break on the upstream agentToolId so equal types never reorder by API response order.
109+
combinedAgents.sort(
110+
(a, b) => a.agentType.localeCompare(b.agentType) || (a.agentToolId ?? '').localeCompare(b.agentToolId ?? ''),
111+
);
113112

114113
const hasAgents = combinedAgents.length > 0;
115114

0 commit comments

Comments
 (0)