From 1a8a9224b4aabf5a97a8ea6942078bf4471bacd7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Dec 2025 19:32:04 +0000 Subject: [PATCH] Address code review feedback: use deterministic ordering and proper styling Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com> --- app/src/actions/migrations/Connection.ts | 15 ++++++----- .../ProfileList/ConnectionItem.tsx | 27 +++++++++++++++---- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/src/actions/migrations/Connection.ts b/app/src/actions/migrations/Connection.ts index cd6b94d1..c89cce13 100644 --- a/app/src/actions/migrations/Connection.ts +++ b/app/src/actions/migrations/Connection.ts @@ -75,11 +75,8 @@ let migrations: Migration[] = [ if (connection.order !== undefined) { return connection } - // Use a timestamp-based order for existing connections - return { - ...connection, - order: Date.now() + Math.random(), - } + // Order will be assigned during migration based on current position + return connection }, }, ] @@ -94,8 +91,14 @@ function isMigrationNecessary(connections: ConnectionDictionary): boolean { function applyMigrations(connections: ConnectionDictionary): ConnectionDictionary { let newConnectionDictionary: ConnectionDictionary = {} - Object.keys(connections).forEach(key => { + const connectionKeys = Object.keys(connections) + + connectionKeys.forEach((key, index) => { let newConnection = connectionMigrator.applyMigrations(connections[key]) as any + // If the migration didn't assign an order, assign one based on current position + if (newConnection.order === undefined) { + newConnection.order = index + } newConnectionDictionary[newConnection.id] = newConnection }) diff --git a/app/src/components/ConnectionSetup/ProfileList/ConnectionItem.tsx b/app/src/components/ConnectionSetup/ProfileList/ConnectionItem.tsx index 6a19fc3e..0fc02e00 100644 --- a/app/src/components/ConnectionSetup/ProfileList/ConnectionItem.tsx +++ b/app/src/components/ConnectionSetup/ProfileList/ConnectionItem.tsx @@ -41,22 +41,22 @@ const ConnectionItem = (props: Props) => { props.actions.connectionManager.selectConnection(props.connection.id)} onDoubleClick={() => { props.actions.connectionManager.selectConnection(props.connection.id) connect() }} > - + {props.connection.name || 'mqtt broker'} {connection && connection.url} - - + + - + @@ -87,6 +87,23 @@ export const connectionItemStyle = (theme: Theme) => ({ color: theme.palette.text.secondary, fontSize: '0.7em', }, + itemContainer: { + display: 'flex' as 'flex', + alignItems: 'center' as 'center', + padding: '8px 8px 8px 16px', + }, + textContainer: { + flex: 1, + overflow: 'hidden' as 'hidden', + }, + buttonContainer: { + display: 'flex' as 'flex', + flexDirection: 'column' as 'column', + marginLeft: '4px', + }, + arrowButton: { + padding: '2px', + }, }) export default connect(null, mapDispatchToProps)(withStyles(connectionItemStyle)(ConnectionItem) as any)