Fix closing saved workflows (#1049)

* Fix workflow save. Resolves #996 Resolves #1048

* Add test on closing tabs

* Add test on closing open workflows in sidebar
This commit is contained in:
bymyself
2024-09-30 12:09:24 -07:00
committed by GitHub
parent 0117964ca5
commit 04e1344676
3 changed files with 66 additions and 0 deletions

View File

@@ -405,7 +405,13 @@ export class ComfyWorkflow {
if (!this.path) {
// Saved new workflow, patch this instance
const oldKey = this.key
this.updatePath(path, null)
// Update workflowLookup: change the key from the old unsaved path to the new saved path
delete this.manager.workflowStore.workflowLookup[oldKey]
this.manager.workflowStore.workflowLookup[this.key] = this
await this.manager.loadWorkflows()
this.unsaved = false
this.manager.dispatchEvent(new CustomEvent('rename', { detail: this }))