feat(duplicate): added folder duplication, add duplicate to sidebar context menu#1902
Merged
waleedlatif1 merged 1 commit intostagingfrom Nov 11, 2025
Merged
feat(duplicate): added folder duplication, add duplicate to sidebar context menu#1902waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryThis PR adds comprehensive folder duplication functionality to match existing workflow duplication capabilities. The implementation includes recursive folder structure duplication and workflow duplication within those folders. Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant UI as Folder/Workflow Item
participant Hook as useDuplicate Hook
participant Store as Folder/Workflow Store
participant API as Duplicate API
participant Helper as duplicateWorkflow Helper
participant DB as Database
User->>UI: Right-click & select "Duplicate"
UI->>Hook: handleDuplicate()
Hook->>Hook: Check isDuplicating state
Hook->>Store: duplicateFolder/Workflow(id)
alt Folder Duplication
Store->>API: POST /api/folders/{id}/duplicate
API->>DB: Check permissions & get source folder
API->>DB: BEGIN TRANSACTION
API->>DB: Create root folder with new ID
API->>API: duplicateFolderStructure (recursive)
loop For each child folder
API->>DB: Create child folder
API->>API: Recurse for nested children
end
DB-->>API: COMMIT (folder structure complete)
API->>API: duplicateWorkflowsInFolderTree
loop For each folder in mapping
API->>DB: Get workflows in folder
loop For each workflow
API->>Helper: duplicateWorkflow()
Helper->>DB: BEGIN TRANSACTION
Helper->>DB: Create workflow with new ID
Helper->>DB: Copy blocks (remap IDs & parentIds)
Helper->>DB: Copy edges (remap block references)
Helper->>DB: Copy subflows (remap IDs & node refs)
DB-->>Helper: COMMIT
Helper-->>API: Return new workflow ID
end
end
API-->>Store: Return folder stats
else Workflow Duplication
Store->>API: POST /api/workflows/{id}/duplicate
API->>Helper: duplicateWorkflow()
Helper->>DB: Check permissions & get source
Helper->>DB: BEGIN TRANSACTION
Helper->>DB: Create workflow with new ID
Helper->>DB: Copy blocks (remap IDs)
Helper->>DB: Copy edges (remap references)
Helper->>DB: Copy subflows (remap IDs)
DB-->>Helper: COMMIT
Helper-->>API: Return new workflow
API-->>Store: Return workflow metadata
end
Store->>Store: Refresh folders/workflows
Store-->>Hook: Return new ID(s)
Hook->>Store: clearSelection()
alt Single Workflow Duplication
Hook->>UI: Navigate to new workflow
end
Hook-->>UI: Complete
UI-->>User: Show duplicated item
|
waleedlatif1
added a commit
that referenced
this pull request
Nov 12, 2025
waleedlatif1
added a commit
that referenced
this pull request
Nov 12, 2025
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