-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(sortOrder): initial ordering must be deterministic #2833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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
|
Summary
Type of Change
Testing
Tested manually
Checklist