fix(sortOrder): initial ordering must be deterministic#2833
Merged
icecrasher321 merged 3 commits intostagingfrom Jan 15, 2026
Merged
fix(sortOrder): initial ordering must be deterministic#2833icecrasher321 merged 3 commits intostagingfrom
icecrasher321 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryChanges workflow ordering from max-based (appending new items at bottom) to min-based (prepending new items at top), implementing deterministic three-way sort comparison across the entire workflow list system. Key changes:
Implementation consistency: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant UI as WorkflowList Component
participant Store as WorkflowRegistry Store
participant API as POST /api/workflows
participant DB as Database
Note over User,DB: Creating New Workflow
User->>UI: Create new workflow
UI->>Store: Get existing workflows
Store-->>UI: Return workflows with sortOrder
UI->>UI: Calculate min(sortOrder) - 1
UI->>API: POST with sortOrder
API->>DB: Query min(sortOrder) from folder
DB-->>API: Return minOrder
API->>API: Calculate sortOrder = (minOrder ?? 1) - 1
API->>DB: INSERT workflow with sortOrder, createdAt
DB-->>API: Success
API-->>UI: Return new workflow
Note over User,DB: Loading Workflows
User->>API: GET /api/workflows
API->>DB: SELECT * ORDER BY sortOrder ASC, createdAt ASC, id ASC
DB-->>API: Return ordered workflows
API-->>UI: Return workflows
UI->>UI: Apply compareByOrder(sortOrder, createdAt, id)
UI-->>User: Display workflows in deterministic order
Note over User,DB: Drag and Drop Reorder
User->>UI: Drag workflow to new position
UI->>UI: Calculate new order array
UI->>UI: Reassign sortOrder = 0, 1, 2, 3...
UI->>API: POST /api/workflows/reorder
API->>DB: UPDATE workflows SET sortOrder
DB-->>API: Success
API-->>UI: Return success
UI-->>User: Display reordered workflows
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Tested manually
Checklist