Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[feat] Allow opening workflows with same name as new tabs
When importing a workflow file that has the same name as an existing
open workflow, create a new tab with a unique suffix (2), (3), etc.
instead of silently failing or replacing the existing workflow.

- Add forceNew parameter to createTemporary() in workflowStore
- Always create new temporary workflow when importing via file picker
- Remove logic that looked up persisted workflows by name during import
  • Loading branch information
Myestery committed Dec 2, 2025
commit 8299a201d15f5ae28e435afa2bbb4d65f371039b
18 changes: 18 additions & 0 deletions src/platform/workflow/core/services/workflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,24 @@

if (value === null || typeof value === 'string') {
const path = value as string | null

// Check if a persisted workflow with this path exists
if (path) {
const fullPath = ComfyWorkflow.basePath + appendJsonExt(path)

Check failure on line 318 in src/platform/workflow/core/services/workflowService.ts

View workflow job for this annotation

GitHub Actions / collect

'ComfyWorkflow' cannot be used as a value because it was imported using 'import type'.

Check failure on line 318 in src/platform/workflow/core/services/workflowService.ts

View workflow job for this annotation

GitHub Actions / setup

'ComfyWorkflow' cannot be used as a value because it was imported using 'import type'.
const existingWorkflow = workflowStore.getWorkflowByPath(fullPath)

// If the workflow exists and is NOT loaded yet (restoration case),
// use the existing workflow instead of creating a new one.
// If it IS loaded, this is a re-import case - create new with suffix.
if (existingWorkflow?.isPersisted && !existingWorkflow.isLoaded) {
const loadedWorkflow =
await workflowStore.openWorkflow(existingWorkflow)
loadedWorkflow.changeTracker.reset(workflowData)
loadedWorkflow.changeTracker.restore()
return
}
}

const tempWorkflow = workflowStore.createTemporary(
path ? appendJsonExt(path) : undefined,
workflowData,
Expand Down
Loading