Generate a new workflow id when using "save as" (#3407)

This commit is contained in:
filtered
2025-04-12 05:43:10 +10:00
committed by GitHub
parent 1990f25638
commit 60c0ce228a
2 changed files with 9 additions and 5 deletions

View File

@@ -94,10 +94,14 @@ export const useWorkflowService = () => {
await renameWorkflow(workflow, newPath)
await workflowStore.saveWorkflow(workflow)
} else {
const tempWorkflow = workflowStore.createTemporary(
newKey,
workflow.activeState as ComfyWorkflowJSON
)
// Generate new id when saving existing workflow as a new file
const id = crypto.randomUUID()
const state = JSON.parse(
JSON.stringify(workflow.activeState)
) as ComfyWorkflowJSON
state.id = id
const tempWorkflow = workflowStore.createTemporary(newKey, state)
await openWorkflow(tempWorkflow)
await workflowStore.saveWorkflow(tempWorkflow)
}

View File

@@ -441,7 +441,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
getWorkflowByPath,
syncWorkflows
}
}) as unknown as () => WorkflowStore
}) as () => WorkflowStore
export const useWorkflowBookmarkStore = defineStore('workflowBookmark', () => {
const bookmarks = ref<Set<string>>(new Set())