mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 13:10:24 +00:00
## Summary Change app mode changes to be written directly to the workflow on change instead of requiring explicit save via builder. Temporary: Adds `.app.json` file extension to app files for identification since we don't currently have a way to identify them with metadata Removes app builder save dialog and replaces it with default mode selection ## Changes - **What**: - ensure all save locations handle app mode - remove dirtyLinearData and flushing - **Breaking**: - if people are relying on workflow names and are converting to/from app mode in the same workflow, they will gain/lose the `.app` part of the extension ## Screenshots (if applicable) <img width="689" height="84" alt="image" src="https://github.com/user-attachments/assets/335596ee-dce9-4e3a-a7b5-f0715c294e41" /> <img width="421" height="324" alt="image" src="https://github.com/user-attachments/assets/ad3cd33c-e9f0-4c30-8874-d4507892fc6b" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9338-feat-App-mode-saving-rework-3176d73d3650813f9ae1f6c5a234da8c) by [Unito](https://www.unito.io)
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { computed } from 'vue'
|
|
|
|
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
|
|
import { app } from '@/scripts/app'
|
|
import { useDialogService } from '@/services/dialogService'
|
|
import { useDialogStore } from '@/stores/dialogStore'
|
|
|
|
import DefaultViewDialogContent from './DefaultViewDialogContent.vue'
|
|
|
|
const DIALOG_KEY = 'builder-default-view'
|
|
|
|
export function useAppSetDefaultView() {
|
|
const workflowStore = useWorkflowStore()
|
|
const dialogService = useDialogService()
|
|
const dialogStore = useDialogStore()
|
|
|
|
const settingView = computed(() => dialogStore.isDialogOpen(DIALOG_KEY))
|
|
|
|
function showDialog() {
|
|
dialogService.showLayoutDialog({
|
|
key: DIALOG_KEY,
|
|
component: DefaultViewDialogContent,
|
|
props: {
|
|
initialOpenAsApp: workflowStore.activeWorkflow?.initialMode !== 'graph',
|
|
onApply: handleApply,
|
|
onClose: closeDialog
|
|
}
|
|
})
|
|
}
|
|
|
|
function handleApply(openAsApp: boolean) {
|
|
const workflow = workflowStore.activeWorkflow
|
|
if (!workflow) return
|
|
|
|
workflow.initialMode = openAsApp ? 'app' : 'graph'
|
|
const extra = (app.rootGraph.extra ??= {})
|
|
extra.linearMode = openAsApp
|
|
workflow.changeTracker?.checkState()
|
|
closeDialog()
|
|
}
|
|
|
|
function closeDialog() {
|
|
dialogStore.closeDialog({ key: DIALOG_KEY })
|
|
}
|
|
|
|
return { settingView, showDialog }
|
|
}
|