File tree Expand file tree Collapse file tree 3 files changed +9
-29
lines changed
apps/sim/app/workspace/[workspaceId]/w
panel/components/copilot/components/user-input Expand file tree Collapse file tree 3 files changed +9
-29
lines changed Original file line number Diff line number Diff line change @@ -1101,21 +1101,11 @@ export function ControlBar({ hasValidationErrors = false }: ControlBarProps) {
11011101 * Get workflows in the exact order they appear in the sidebar
11021102 */
11031103 const getSidebarOrderedWorkflows = ( ) => {
1104- // Get and sort regular workflows by last modified (newest first)
1104+ // Get and sort regular workflows by name alphabetically for stable ordering
11051105 const regularWorkflows = Object . values ( workflows )
11061106 . filter ( ( workflow ) => workflow . workspaceId === workspaceId )
11071107 . filter ( ( workflow ) => workflow . marketplaceData ?. status !== 'temp' )
1108- . sort ( ( a , b ) => {
1109- const dateA =
1110- a . lastModified instanceof Date
1111- ? a . lastModified . getTime ( )
1112- : new Date ( a . lastModified ) . getTime ( )
1113- const dateB =
1114- b . lastModified instanceof Date
1115- ? b . lastModified . getTime ( )
1116- : new Date ( b . lastModified ) . getTime ( )
1117- return dateB - dateA
1118- } )
1108+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
11191109
11201110 // Group workflows by folder
11211111 const workflowsByFolder = regularWorkflows . reduce (
Original file line number Diff line number Diff line change @@ -393,11 +393,9 @@ const UserInput = forwardRef<UserInputRef, UserInputProps>(
393393 const workspaceFiltered = items . filter (
394394 ( w : any ) => w . workspaceId === workspaceId || ! w . workspaceId
395395 )
396- // Sort by last modified/updated (newest first) , matching sidebar behavior
396+ // Sort by name alphabetically for stable ordering , matching sidebar behavior
397397 const sorted = [ ...workspaceFiltered ] . sort ( ( a : any , b : any ) => {
398- const ta = new Date ( a . lastModified || a . updatedAt || a . createdAt || 0 ) . getTime ( )
399- const tb = new Date ( b . lastModified || b . updatedAt || b . createdAt || 0 ) . getTime ( )
400- return tb - ta
398+ return ( a . name || 'Untitled Workflow' ) . localeCompare ( b . name || 'Untitled Workflow' )
401399 } )
402400 setWorkflows (
403401 sorted . map ( ( w : any ) => ( {
Original file line number Diff line number Diff line change @@ -691,21 +691,13 @@ export function Sidebar() {
691691 }
692692 } )
693693
694- // Sort by last modified date (newest first)
695- const sortByLastModified = ( a : WorkflowMetadata , b : WorkflowMetadata ) => {
696- const dateA =
697- a . lastModified instanceof Date
698- ? a . lastModified . getTime ( )
699- : new Date ( a . lastModified ) . getTime ( )
700- const dateB =
701- b . lastModified instanceof Date
702- ? b . lastModified . getTime ( )
703- : new Date ( b . lastModified ) . getTime ( )
704- return dateB - dateA
694+ // Sort by name alphabetically for stable ordering
695+ const sortByName = ( a : WorkflowMetadata , b : WorkflowMetadata ) => {
696+ return a . name . localeCompare ( b . name )
705697 }
706698
707- regular . sort ( sortByLastModified )
708- temp . sort ( sortByLastModified )
699+ regular . sort ( sortByName )
700+ temp . sort ( sortByName )
709701 }
710702
711703 return { regularWorkflows : regular , tempWorkflows : temp }
You can’t perform that action at this time.
0 commit comments