Fix duplication of persisted workflow (#2124)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2025-01-02 12:16:39 -05:00
committed by GitHub
parent bb988edf9f
commit 9c1eacf0af
15 changed files with 70 additions and 2 deletions

View File

@@ -357,7 +357,11 @@ export const useWorkflowService = () => {
*/
const duplicateWorkflow = async (workflow: ComfyWorkflow) => {
const state = JSON.parse(JSON.stringify(workflow.activeState))
await app.loadGraphData(state, true, true, workflow.filename)
const suffix = workflow.isPersisted ? ' (Copy)' : ''
// Remove the suffix `(2)` or similar
const filename = workflow.filename.replace(/\s*\(\d+\)$/, '') + suffix
await app.loadGraphData(state, true, true, filename)
}
return {