Don't prompt unsaved when there is no unsaved workflow on window close (#2257)

This commit is contained in:
Chenlei Hu
2025-01-15 16:34:05 -05:00
committed by GitHub
parent c039a60fcc
commit d7fb25a36a

View File

@@ -13,11 +13,16 @@
import { onBeforeUnmount, onMounted } from 'vue'
import { useSettingStore } from '@/stores/settingStore'
import { useWorkflowStore } from '@/stores/workflowStore'
const settingStore = useSettingStore()
const workflowStore = useWorkflowStore()
const handleBeforeUnload = (event: BeforeUnloadEvent) => {
if (settingStore.get('Comfy.Window.UnloadConfirmation')) {
if (
settingStore.get('Comfy.Window.UnloadConfirmation') &&
workflowStore.modifiedWorkflows.length > 0
) {
event.preventDefault()
return true
}