App mode - builder toolbar save - 7 (#9030)

## Summary

Implements save flow for the builder toolbar.
The todo will be done in a future PR once the serailized format is
finalized

## Screenshots (if applicable)


https://github.com/user-attachments/assets/124cb7d8-e23b-476a-8691-0ee2c4c9150b

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9030-App-mode-builder-toolbar-save-7-30d6d73d3650815e8610fced20e95e6e)
by [Unito](https://www.unito.io)
This commit is contained in:
pythongosssss
2026-02-23 18:57:52 +00:00
committed by GitHub
parent b3a5317500
commit 2634acdd8c
7 changed files with 366 additions and 7 deletions

View File

@@ -90,10 +90,21 @@ export const useWorkflowService = () => {
/**
* Save a workflow as a new file
* @param workflow The workflow to save
* @param options.filename Pre-supplied filename (skips the prompt dialog)
* @param options.openAsApp If set, updates linearMode extra before saving
*/
const saveWorkflowAs = async (workflow: ComfyWorkflow) => {
const newFilename = await workflow.promptSave()
if (!newFilename) return
const saveWorkflowAs = async (
workflow: ComfyWorkflow,
options: { filename?: string; openAsApp?: boolean } = {}
): Promise<boolean> => {
const newFilename = options.filename ?? (await workflow.promptSave())
if (!newFilename) return false
if (options.openAsApp !== undefined) {
app.rootGraph.extra ??= {}
app.rootGraph.extra.linearMode = options.openAsApp
workflow.changeTracker?.checkState()
}
const newPath = workflow.directory + '/' + appendJsonExt(newFilename)
const existingWorkflow = workflowStore.getWorkflowByPath(newPath)
@@ -106,14 +117,14 @@ export const useWorkflowService = () => {
itemList: [newPath]
})
if (res !== true) return
if (res !== true) return false
if (existingWorkflow.path === workflow.path) {
await saveWorkflow(workflow)
return
return true
}
const deleted = await deleteWorkflow(existingWorkflow, true)
if (!deleted) return
if (!deleted) return false
}
if (workflow.isTemporary) {
@@ -124,6 +135,7 @@ export const useWorkflowService = () => {
await openWorkflow(tempWorkflow)
await workflowStore.saveWorkflow(tempWorkflow)
}
return true
}
/**