Add Comfy.Workflow.SortNodeIdOnSave setting (#502)

* Update litegraph (Sort order)

* nit

* Add sort node on save setting

* nit
This commit is contained in:
Chenlei Hu
2024-08-17 23:23:40 -04:00
committed by GitHub
parent 9d3ca763d0
commit d8887a434d
6 changed files with 25 additions and 11 deletions

View File

@@ -1925,7 +1925,10 @@ export class ComfyApp {
// Save current workflow automatically
setInterval(() => {
const workflow = JSON.stringify(this.graph.serialize())
const sortNodes =
this.vueAppReady &&
useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
const workflow = JSON.stringify(this.graph.serialize({ sortNodes }))
localStorage.setItem('workflow', workflow)
if (api.clientId) {
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
@@ -2396,7 +2399,10 @@ export class ComfyApp {
}
}
const workflow = graph.serialize()
const sortNodes =
this.vueAppReady &&
useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
const workflow = graph.serialize({ sortNodes })
const output = {}
// Process nodes in order of execution
for (const outerNode of graph.computeExecutionOrder(false)) {