[lint] Enforce @typescript-eslint/no-floating-promises (#3402)

This commit is contained in:
Chenlei Hu
2025-04-11 12:19:22 -04:00
committed by GitHub
parent 59e20964a0
commit dc5d7ea1be
60 changed files with 305 additions and 279 deletions

View File

@@ -20,6 +20,13 @@ export default [
globals: {
...globals.browser,
__COMFYUI_FRONTEND_VERSION__: 'readonly'
},
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2020,
sourceType: 'module',
extraFileExtensions: ['.vue']
}
}
},
@@ -28,13 +35,10 @@ export default [
...pluginVue.configs['flat/essential'],
{
files: ['src/**/*.vue'],
languageOptions: { parserOptions: { parser: tseslint.parser } }
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/prefer-as-const': 'off'
languageOptions: {
parserOptions: {
parser: tseslint.parser
}
}
},
{
@@ -42,6 +46,7 @@ export default [
'unused-imports': unusedImports
},
rules: {
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/prefer-as-const': 'off',

View File

@@ -89,9 +89,9 @@ const setInitialPosition = () => {
}
}
onMounted(setInitialPosition)
watch(visible, (newVisible) => {
watch(visible, async (newVisible) => {
if (newVisible) {
nextTick(setInitialPosition)
await nextTick(setInitialPosition)
}
})

View File

@@ -135,12 +135,12 @@ const hasPendingTasks = computed(
)
const commandStore = useCommandStore()
const queuePrompt = (e: Event) => {
const queuePrompt = async (e: Event) => {
const commandId =
'shiftKey' in e && e.shiftKey
? 'Comfy.QueuePromptFront'
: 'Comfy.QueuePrompt'
commandStore.execute(commandId)
await commandStore.execute(commandId)
}
</script>

View File

@@ -24,17 +24,17 @@ const terminalCreated = (
root,
autoRows: true,
autoCols: true,
onResize: () => {
onResize: async () => {
// If we aren't visible, don't resize
if (!terminal.element?.offsetParent) return
terminalApi.resize(terminal.cols, terminal.rows)
await terminalApi.resize(terminal.cols, terminal.rows)
}
})
onMounted(async () => {
offData = terminal.onData(async (message: string) => {
terminalApi.write(message)
await terminalApi.write(message)
})
offOutput = terminalApi.onOutput((message) => {

View File

@@ -57,7 +57,7 @@ const terminalCreated = (
if (!clientId.value) {
await until(clientId).not.toBeNull()
}
api.subscribeLogs(true)
await api.subscribeLogs(true)
api.addEventListener('logs', logReceived)
}
@@ -76,9 +76,9 @@ const terminalCreated = (
loading.value = false
})
onUnmounted(() => {
onUnmounted(async () => {
if (api.clientId) {
api.subscribeLogs(false)
await api.subscribeLogs(false)
}
api.removeEventListener('logs', logReceived)
})

View File

@@ -45,10 +45,10 @@ const finishEditing = () => {
}
watch(
() => isEditing,
(newVal) => {
async (newVal) => {
if (newVal) {
inputValue.value = modelValue
nextTick(() => {
await nextTick(() => {
if (!inputRef.value) return
const fileName = inputValue.value.includes('.')
? inputValue.value.split('.').slice(0, -1).join('.')

View File

@@ -186,9 +186,9 @@ const menuItems = computed<MenuItem[]>(() =>
{
label: t('g.delete'),
icon: 'pi pi-trash',
command: () => {
command: async () => {
if (menuTargetNode.value) {
deleteCommand(menuTargetNode.value)
await deleteCommand(menuTargetNode.value)
}
},
visible: menuTargetNode.value?.handleDelete !== undefined,

View File

@@ -60,7 +60,7 @@ describe('UrlInput', () => {
})
})
wrapper.setProps({ modelValue: 'https://test.com' })
await wrapper.setProps({ modelValue: 'https://test.com' })
await nextTick()
await nextTick()
@@ -74,7 +74,7 @@ describe('UrlInput', () => {
validateUrlFn: () => Promise.resolve(true)
})
wrapper.setProps({ modelValue: 'https://test.com' })
await wrapper.setProps({ modelValue: 'https://test.com' })
await nextTick()
await nextTick()
@@ -88,7 +88,7 @@ describe('UrlInput', () => {
validateUrlFn: () => Promise.resolve(false)
})
wrapper.setProps({ modelValue: 'https://test.com' })
await wrapper.setProps({ modelValue: 'https://test.com' })
await nextTick()
await nextTick()
@@ -141,14 +141,14 @@ describe('UrlInput', () => {
}
})
wrapper.setProps({ modelValue: 'https://test.com' })
await wrapper.setProps({ modelValue: 'https://test.com' })
await nextTick()
await nextTick()
// Trigger multiple validations in quick succession
wrapper.find('.pi-spinner').trigger('click')
wrapper.find('.pi-spinner').trigger('click')
wrapper.find('.pi-spinner').trigger('click')
await wrapper.find('.pi-spinner').trigger('click')
await wrapper.find('.pi-spinner').trigger('click')
await wrapper.find('.pi-spinner').trigger('click')
await nextTick()
await nextTick()

View File

@@ -129,9 +129,12 @@ const missingModels = computed(() => {
})
})
onBeforeUnmount(() => {
onBeforeUnmount(async () => {
if (doNotAskAgain.value) {
useSettingStore().set('Comfy.Workflow.ShowMissingModelsWarning', false)
await useSettingStore().set(
'Comfy.Workflow.ShowMissingModelsWarning',
false
)
}
})
</script>

View File

@@ -222,13 +222,13 @@ const filterOutdatedPacks = (packs: components['schemas']['Node'][]) =>
watch(
[isUpdateAvailableTab, installedPacks],
() => {
async () => {
if (!isUpdateAvailableTab.value) return
if (!isEmptySearch.value) {
displayPacks.value = filterOutdatedPacks(installedPacks.value)
} else if (!installedPacks.value.length) {
startFetchInstalled()
await startFetchInstalled()
} else {
displayPacks.value = filterOutdatedPacks(installedPacks.value)
}
@@ -238,7 +238,7 @@ watch(
watch(
[isInstalledTab, installedPacks],
() => {
async () => {
if (!isInstalledTab.value) return
if (!isEmptySearch.value) {
@@ -248,7 +248,7 @@ watch(
!installedPacksReady.value &&
!isLoadingInstalled.value
) {
startFetchInstalled()
await startFetchInstalled()
} else {
displayPacks.value = installedPacks.value
}
@@ -258,7 +258,7 @@ watch(
watch(
[isMissingTab, isWorkflowTab, workflowPacks, installedPacks],
() => {
async () => {
if (!isWorkflowTab.value && !isMissingTab.value) return
if (!isEmptySearch.value) {
@@ -270,9 +270,9 @@ watch(
!isLoadingWorkflow.value &&
!workflowPacksReady.value
) {
startFetchWorkflowPacks()
await startFetchWorkflowPacks()
if (isMissingTab.value) {
startFetchInstalled()
await startFetchInstalled()
}
} else {
displayPacks.value = isMissingTab.value

View File

@@ -55,7 +55,7 @@ const { palettes, activePaletteId } = storeToRefs(colorPaletteStore)
const importCustomPalette = async () => {
const palette = await colorPaletteService.importColorPalette()
if (palette) {
settingStore.set('Comfy.ColorPalette', palette.id)
await settingStore.set('Comfy.ColorPalette', palette.id)
}
}
</script>

View File

@@ -22,8 +22,8 @@ import Message from 'primevue/message'
import { useUserStore } from '@/stores/userStore'
const userStore = useUserStore()
const logout = () => {
userStore.logout()
const logout = async () => {
await userStore.logout()
window.location.reload()
}
</script>

View File

@@ -116,44 +116,44 @@ const hasChanges = computed(() => {
return changedExtensions.value.length > 0
})
const updateExtensionStatus = () => {
const updateExtensionStatus = async () => {
const editingDisabledExtensionNames = Object.entries(
editingEnabledExtensions.value
)
.filter(([_, enabled]) => !enabled)
.map(([name]) => name)
settingStore.set('Comfy.Extension.Disabled', [
await settingStore.set('Comfy.Extension.Disabled', [
...extensionStore.inactiveDisabledExtensionNames,
...editingDisabledExtensionNames
])
}
const enableAllExtensions = () => {
const enableAllExtensions = async () => {
extensionStore.extensions.forEach((ext) => {
if (extensionStore.isExtensionReadOnly(ext.name)) return
editingEnabledExtensions.value[ext.name] = true
})
updateExtensionStatus()
await updateExtensionStatus()
}
const disableAllExtensions = () => {
const disableAllExtensions = async () => {
extensionStore.extensions.forEach((ext) => {
if (extensionStore.isExtensionReadOnly(ext.name)) return
editingEnabledExtensions.value[ext.name] = false
})
updateExtensionStatus()
await updateExtensionStatus()
}
const disableThirdPartyExtensions = () => {
const disableThirdPartyExtensions = async () => {
extensionStore.extensions.forEach((ext) => {
if (extensionStore.isCoreExtension(ext.name)) return
editingEnabledExtensions.value[ext.name] = false
})
updateExtensionStatus()
await updateExtensionStatus()
}
const applyChanges = () => {

View File

@@ -18,9 +18,9 @@ import { useSettingStore } from '@/stores/settingStore'
const settingStore = useSettingStore()
const show = computed(() => !settingStore.exists('Comfy.UseNewMenu'))
const handleClose = () => {
const handleClose = async () => {
// Explicitly write the current value to the store.
const currentValue = settingStore.get('Comfy.UseNewMenu')
settingStore.set('Comfy.UseNewMenu', currentValue)
await settingStore.set('Comfy.UseNewMenu', currentValue)
}
</script>

View File

@@ -211,14 +211,14 @@ watchEffect(() => {
}
})
function removeKeybinding(commandData: ICommandData) {
async function removeKeybinding(commandData: ICommandData) {
if (commandData.keybinding) {
keybindingStore.unsetKeybinding(commandData.keybinding)
keybindingService.persistUserKeybindings()
await keybindingService.persistUserKeybindings()
}
}
function captureKeybinding(event: KeyboardEvent) {
async function captureKeybinding(event: KeyboardEvent) {
// Allow the use of keyboard shortcuts when adding keyboard shortcuts
if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
switch (event.key) {
@@ -226,7 +226,7 @@ function captureKeybinding(event: KeyboardEvent) {
cancelEdit()
return
case 'Enter':
saveKeybinding()
await saveKeybinding()
return
}
}
@@ -240,7 +240,7 @@ function cancelEdit() {
newBindingKeyCombo.value = null
}
function saveKeybinding() {
async function saveKeybinding() {
if (currentEditingCommand.value && newBindingKeyCombo.value) {
const updated = keybindingStore.updateKeybindingOnCommand(
new KeybindingImpl({
@@ -249,7 +249,7 @@ function saveKeybinding() {
})
)
if (updated) {
keybindingService.persistUserKeybindings()
await keybindingService.persistUserKeybindings()
}
}
cancelEdit()

View File

@@ -97,16 +97,16 @@ const revertChanges = () => {
serverConfigStore.revertChanges()
}
const restartApp = () => {
electronAPI().restartApp()
const restartApp = async () => {
await electronAPI().restartApp()
}
watch(launchArgs, (newVal) => {
settingStore.set('Comfy.Server.LaunchArgs', newVal)
watch(launchArgs, async (newVal) => {
await settingStore.set('Comfy.Server.LaunchArgs', newVal)
})
watch(serverConfigValues, (newVal) => {
settingStore.set('Comfy.Server.ServerConfigValues', newVal)
watch(serverConfigValues, async (newVal) => {
await settingStore.set('Comfy.Server.ServerConfigValues', newVal)
})
const { copyToClipboard } = useCopyToClipboard()

View File

@@ -69,7 +69,7 @@ const formItem = computed(() => {
const settingStore = useSettingStore()
const settingValue = computed(() => settingStore.get(props.setting.id))
const updateSettingValue = (value: any) => {
settingStore.set(props.setting.id, value)
const updateSettingValue = async (value: any) => {
await settingStore.set(props.setting.id, value)
}
</script>

View File

@@ -99,8 +99,8 @@ const handleRestart = async () => {
await useComfyManagerService().rebootComfyUI()
closeDialog()
const onReconnect = () => {
useCommandStore().execute('Comfy.RefreshNodeDefinitions')
const onReconnect = async () => {
await useCommandStore().execute('Comfy.RefreshNodeDefinitions')
comfyManagerStore.clearLogs()
comfyManagerStore.setStale()
}

View File

@@ -150,16 +150,16 @@ const colorPaletteService = useColorPaletteService()
const colorPaletteStore = useColorPaletteStore()
watch(
[() => canvasStore.canvas, () => settingStore.get('Comfy.ColorPalette')],
([canvas, currentPaletteId]) => {
async ([canvas, currentPaletteId]) => {
if (!canvas) return
colorPaletteService.loadColorPalette(currentPaletteId)
await colorPaletteService.loadColorPalette(currentPaletteId)
}
)
watch(
() => colorPaletteStore.activePaletteId,
(newValue) => {
settingStore.set('Comfy.ColorPalette', newValue)
async (newValue) => {
await settingStore.set('Comfy.ColorPalette', newValue)
}
)
@@ -292,7 +292,7 @@ onMounted(async () => {
() => settingStore.get('Comfy.Locale'),
async () => {
await useCommandStore().execute('Comfy.RefreshNodeDefinitions')
useWorkflowService().reloadCurrentWorkflow()
await useWorkflowService().reloadCurrentWorkflow()
}
)

View File

@@ -80,10 +80,10 @@ const linkHidden = computed(
)
let interval: number | null = null
const repeat = (command: string) => {
const repeat = async (command: string) => {
if (interval) return
const cmd = () => commandStore.execute(command)
cmd()
await cmd()
interval = window.setInterval(cmd, 100)
}
const stopRepeat = () => {

View File

@@ -142,12 +142,12 @@ const browsePath = async () => {
}
}
const onFocus = () => {
const onFocus = async () => {
if (!inputTouched.value) {
inputTouched.value = true
return
}
// Refresh validation on re-focus
validatePath(installPath.value)
await validatePath(installPath.value)
}
</script>

View File

@@ -71,7 +71,7 @@ const eventConfig = {
textureLoadingEnd: () => loadingOverlayRef.value?.endLoading()
} as const
watchEffect(() => {
watchEffect(async () => {
if (load3d.value) {
const rawLoad3d = toRaw(load3d.value)
@@ -81,7 +81,7 @@ watchEffect(() => {
rawLoad3d.setFOV(props.fov)
rawLoad3d.toggleCamera(props.cameraType)
rawLoad3d.togglePreview(props.showPreview)
rawLoad3d.setBackgroundImage(props.backgroundImage)
await rawLoad3d.setBackgroundImage(props.backgroundImage)
rawLoad3d.setUpDirection(props.upDirection)
}
})

View File

@@ -135,11 +135,11 @@ const search = (query: string) => {
const emit = defineEmits(['addFilter', 'removeFilter', 'addNode'])
let inputElement: HTMLInputElement | null = null
const reFocusInput = () => {
const reFocusInput = async () => {
inputElement ??= document.getElementById(inputId) as HTMLInputElement
if (inputElement) {
inputElement.blur()
nextTick(() => inputElement?.focus())
await nextTick(() => inputElement?.focus())
}
}
@@ -150,14 +150,14 @@ const onAddFilter = (
nodeSearchFilterVisible.value = false
emit('addFilter', filterAndValue)
}
const onRemoveFilter = (
const onRemoveFilter = async (
event: Event,
filterAndValue: FuseFilterWithValue<ComfyNodeDefImpl, string>
) => {
event.stopPropagation()
event.preventDefault()
emit('removeFilter', filterAndValue)
reFocusInput()
await reFocusInput()
}
const setHoverSuggestion = (index: number) => {
if (index === -1) {

View File

@@ -16,8 +16,8 @@ const userStore = useUserStore()
const tooltip = computed(
() => `${t('sideToolbar.logout')} (${userStore.currentUser?.username})`
)
const logout = () => {
userStore.logout()
const logout = async () => {
await userStore.logout()
window.location.reload()
}
</script>

View File

@@ -23,7 +23,7 @@ const icon = computed(() =>
)
const commandStore = useCommandStore()
const toggleTheme = () => {
commandStore.execute('Comfy.ToggleTheme')
const toggleTheme = async () => {
await commandStore.execute('Comfy.ToggleTheme')
}
</script>

View File

@@ -89,9 +89,8 @@ const handleSearch = async (query: string) => {
return model.searchable.includes(search)
})
nextTick(() => {
expandNode(root.value)
})
await nextTick()
expandNode(root.value)
}
type ModelOrFolder = ComfyModelDef | ModelFolder
@@ -177,7 +176,7 @@ watch(
const folderPath = key.split('/').slice(1).join('/')
if (folderPath && !folderPath.includes('/')) {
// Trigger (async) load of model data for this folder
modelStore.getLoadedModelFolder(folderPath)
void modelStore.getLoadedModelFolder(folderPath)
}
}
})

View File

@@ -153,7 +153,7 @@ const filteredRoot = computed<TreeNode | null>(() => {
const filters: Ref<
(SearchFilter & { filter: FuseFilterWithValue<ComfyNodeDefImpl, string> })[]
> = ref([])
const handleSearch = (query: string) => {
const handleSearch = async (query: string) => {
// Don't apply a min length filter because it does not make sense in
// multi-byte languages like Chinese, Japanese, Korean, etc.
if (query.length === 0 && !filters.value.length) {
@@ -174,13 +174,12 @@ const handleSearch = (query: string) => {
}
)
nextTick(() => {
// @ts-expect-error fixme ts strict error
expandNode(filteredRoot.value)
})
await nextTick()
// @ts-expect-error fixme ts strict error
expandNode(filteredRoot.value)
}
const onAddFilter = (
const onAddFilter = async (
filterAndValue: FuseFilterWithValue<ComfyNodeDefImpl, string>
) => {
filters.value.push({
@@ -191,15 +190,15 @@ const onAddFilter = (
id: +new Date()
})
handleSearch(searchQuery.value)
await handleSearch(searchQuery.value)
}
// @ts-expect-error fixme ts strict error
const onRemoveFilter = (filterAndValue) => {
const onRemoveFilter = async (filterAndValue) => {
const index = filters.value.findIndex((f) => f === filterAndValue)
if (index !== -1) {
filters.value.splice(index, 1)
}
handleSearch(searchQuery.value)
await handleSearch(searchQuery.value)
}
</script>

View File

@@ -157,11 +157,11 @@ const toggleExpanded = () => {
isExpanded.value = !isExpanded.value
}
const removeTask = (task: TaskItemImpl) => {
const removeTask = async (task: TaskItemImpl) => {
if (task.isRunning) {
api.interrupt()
await api.interrupt()
}
queueStore.delete(task)
await queueStore.delete(task)
}
const removeAllTasks = async () => {
@@ -251,8 +251,11 @@ const exitFolderView = () => {
folderTask.value = null
}
const toggleImageFit = () => {
settingStore.set(IMAGE_FIT, imageFit.value === 'cover' ? 'contain' : 'cover')
const toggleImageFit = async () => {
await settingStore.set(
IMAGE_FIT,
imageFit.value === 'cover' ? 'contain' : 'cover'
)
}
watch(allTasks, () => {

View File

@@ -160,7 +160,7 @@ const filteredWorkflows = ref<ComfyWorkflow[]>([])
const filteredRoot = computed<TreeNode>(() => {
return buildWorkflowTree(filteredWorkflows.value as ComfyWorkflow[])
})
const handleSearch = (query: string) => {
const handleSearch = async (query: string) => {
if (query.length === 0) {
filteredWorkflows.value = []
expandedKeys.value = {}
@@ -170,9 +170,8 @@ const handleSearch = (query: string) => {
filteredWorkflows.value = workflowStore.workflows.filter((workflow) => {
return workflow.path.toLocaleLowerCase().includes(lowerQuery)
})
nextTick(() => {
expandNode(filteredRoot.value)
})
await nextTick()
expandNode(filteredRoot.value)
}
const workflowStore = useWorkflowStore()
@@ -183,9 +182,9 @@ const expandedKeys = ref<Record<string, boolean>>({})
const { expandNode, toggleNodeOnEvent } = useTreeExpansion(expandedKeys)
const dummyExpandedKeys = ref<Record<string, boolean>>({})
const handleCloseWorkflow = (workflow?: ComfyWorkflow) => {
const handleCloseWorkflow = async (workflow?: ComfyWorkflow) => {
if (workflow) {
workflowService.closeWorkflow(workflow, {
await workflowService.closeWorkflow(workflow, {
warnIfUnsaved: !workspaceStore.shiftDown
})
}
@@ -225,9 +224,12 @@ const renderTreeNode = (
const workflow: ComfyWorkflow = node.data
function handleClick(this: TreeExplorerNode<ComfyWorkflow>, e: MouseEvent) {
async function handleClick(
this: TreeExplorerNode<ComfyWorkflow>,
e: MouseEvent
) {
if (this.leaf) {
workflowService.openWorkflow(workflow)
await workflowService.openWorkflow(workflow)
} else {
toggleNodeOnEvent(e, this)
}
@@ -254,9 +256,9 @@ const renderTreeNode = (
{
label: t('g.insert'),
icon: 'pi pi-file-export',
command: () => {
command: async () => {
const workflow = node.data
workflowService.insertWorkflow(workflow)
await workflowService.insertWorkflow(workflow)
}
}
]

View File

@@ -87,7 +87,7 @@ const handleModelHover = async () => {
modelPreviewStyle.value.left = `${targetRect.left - 400}px`
}
modelDef.value.load()
await modelDef.value.load()
}
const container = ref<HTMLElement | undefined>()
@@ -111,17 +111,17 @@ const showPreview = computed(() => {
const handleMouseEnter = async () => {
isHovered.value = true
await nextTick()
handleModelHover()
await handleModelHover()
}
const handleMouseLeave = () => {
isHovered.value = false
}
onMounted(() => {
onMounted(async () => {
modelContentElement.value =
container.value?.closest('.p-tree-node-content') ?? undefined
modelContentElement.value?.addEventListener('mouseenter', handleMouseEnter)
modelContentElement.value?.addEventListener('mouseleave', handleMouseLeave)
modelDef.value.load()
await modelDef.value.load()
})
onUnmounted(() => {

View File

@@ -82,9 +82,10 @@ const bookmarkedRoot = computed<TreeNode>(() => {
})
watch(
() => props.filteredNodeDefs,
(newValue) => {
async (newValue) => {
if (newValue.length) {
nextTick(() => expandNode(bookmarkedRoot.value))
await nextTick()
expandNode(bookmarkedRoot.value)
}
}
)
@@ -145,9 +146,9 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
},
children: sortedChildren,
draggable: node.leaf,
handleAddFolder(newName: string) {
async handleAddFolder(newName: string) {
if (newName !== '') {
nodeBookmarkStore.addNewBookmarkFolder(this.data, newName)
await nodeBookmarkStore.addNewBookmarkFolder(this.data, newName)
}
},
renderDragPreview(container) {
@@ -158,18 +159,18 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
}
},
droppable: !node.leaf,
handleDrop(data: TreeExplorerDragAndDropData<ComfyNodeDefImpl>) {
async handleDrop(data: TreeExplorerDragAndDropData<ComfyNodeDefImpl>) {
const nodeDefToAdd = data.data.data
// Remove bookmark if the source is the top level bookmarked node.
// @ts-expect-error fixme ts strict error
if (nodeBookmarkStore.isBookmarked(nodeDefToAdd)) {
// @ts-expect-error fixme ts strict error
nodeBookmarkStore.toggleBookmark(nodeDefToAdd)
await nodeBookmarkStore.toggleBookmark(nodeDefToAdd)
}
const folderNodeDef = node.data as ComfyNodeDefImpl
// @ts-expect-error fixme ts strict error
const nodePath = folderNodeDef.category + '/' + nodeDefToAdd.name
nodeBookmarkStore.addBookmark(nodePath)
await nodeBookmarkStore.addBookmark(nodePath)
},
handleClick(e: MouseEvent) {
if (this.leaf) {
@@ -183,14 +184,17 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
...(node.leaf
? {}
: {
handleRename(newName: string) {
async handleRename(newName: string) {
if (this.data && this.data.isDummyFolder) {
nodeBookmarkStore.renameBookmarkFolder(this.data, newName)
await nodeBookmarkStore.renameBookmarkFolder(
this.data,
newName
)
}
},
handleDelete() {
async handleDelete() {
// @ts-expect-error fixme ts strict error
nodeBookmarkStore.deleteBookmarkFolder(this.data)
await nodeBookmarkStore.deleteBookmarkFolder(this.data)
}
})
}
@@ -208,9 +212,9 @@ const showCustomizationDialog = ref(false)
const initialIcon = ref(nodeBookmarkStore.defaultBookmarkIcon)
const initialColor = ref(nodeBookmarkStore.defaultBookmarkColor)
const customizationTargetNodePath = ref('')
const updateCustomization = (icon: string, color: string) => {
const updateCustomization = async (icon: string, color: string) => {
if (customizationTargetNodePath.value) {
nodeBookmarkStore.updateBookmarkCustomization(
await nodeBookmarkStore.updateBookmarkCustomization(
customizationTargetNodePath.value,
{ icon, color }
)

View File

@@ -67,8 +67,8 @@ const sidebarLocation = computed<'left' | 'right'>(() =>
settingStore.get('Comfy.Sidebar.Location')
)
const toggleBookmark = () => {
nodeBookmarkStore.toggleBookmark(nodeDef.value)
const toggleBookmark = async () => {
await nodeBookmarkStore.toggleBookmark(nodeDef.value)
}
const previewRef = ref<InstanceType<typeof NodePreview> | null>(null)
@@ -104,7 +104,7 @@ const isHovered = ref(false)
const handleMouseEnter = async () => {
isHovered.value = true
await nextTick()
handleNodeHover()
await handleNodeHover()
}
const handleMouseLeave = () => {
isHovered.value = false

View File

@@ -32,10 +32,10 @@ const { t } = useI18n()
const toast = useToast()
const workflowStore = useWorkflowStore()
const migrateToLitegraphReroute = () => {
const migrateToLitegraphReroute = async () => {
const workflowJSON = app.graph.serialize() as unknown as WorkflowJSON04
const migratedWorkflowJSON = migrateLegacyRerouteNodes(workflowJSON)
app.loadGraphData(
await app.loadGraphData(
migratedWorkflowJSON,
false,
false,

View File

@@ -89,8 +89,8 @@ const closeWorkflows = async (options: WorkflowOption[]) => {
}
}
const onCloseWorkflow = (option: WorkflowOption) => {
closeWorkflows([option])
const onCloseWorkflow = async (option: WorkflowOption) => {
await closeWorkflows([option])
}
const tabGetter = () => workflowTabRef.value as HTMLElement

View File

@@ -86,7 +86,7 @@ const selectedWorkflow = computed<WorkflowOption | null>(() =>
? workflowToOption(workflowStore.activeWorkflow as ComfyWorkflow)
: null
)
const onWorkflowChange = (option: WorkflowOption) => {
const onWorkflowChange = async (option: WorkflowOption) => {
// Prevent unselecting the current workflow
if (!option) {
return
@@ -96,7 +96,7 @@ const onWorkflowChange = (option: WorkflowOption) => {
return
}
workflowService.openWorkflow(option.workflow)
await workflowService.openWorkflow(option.workflow)
}
const closeWorkflows = async (options: WorkflowOption[]) => {
@@ -112,8 +112,8 @@ const closeWorkflows = async (options: WorkflowOption[]) => {
}
}
const onCloseWorkflow = (option: WorkflowOption) => {
closeWorkflows([option])
const onCloseWorkflow = async (option: WorkflowOption) => {
await closeWorkflows([option])
}
const showContextMenu = (event: MouseEvent, option: WorkflowOption) => {
@@ -128,8 +128,8 @@ const contextMenuItems = computed(() => {
return [
{
label: t('tabMenu.duplicateTab'),
command: () => {
workflowService.duplicateWorkflow(tab.workflow)
command: async () => {
await workflowService.duplicateWorkflow(tab.workflow)
}
},
{
@@ -181,30 +181,30 @@ const handleWheel = (event: WheelEvent) => {
// Scroll to active offscreen tab when opened
watch(
() => workflowStore.activeWorkflow,
() => {
async () => {
if (!selectedWorkflow.value) return
nextTick(() => {
const activeTabElement = document.querySelector('.p-togglebutton-checked')
if (!activeTabElement || !scrollPanelRef.value) return
await nextTick()
const container = scrollPanelRef.value.$el.querySelector(
'.p-scrollpanel-content'
)
if (!container) return
const activeTabElement = document.querySelector('.p-togglebutton-checked')
if (!activeTabElement || !scrollPanelRef.value) return
const tabRect = activeTabElement.getBoundingClientRect()
const containerRect = container.getBoundingClientRect()
const container = scrollPanelRef.value.$el.querySelector(
'.p-scrollpanel-content'
)
if (!container) return
const offsetLeft = tabRect.left - containerRect.left
const offsetRight = tabRect.right - containerRect.right
const tabRect = activeTabElement.getBoundingClientRect()
const containerRect = container.getBoundingClientRect()
if (offsetRight > 0) {
container.scrollBy({ left: offsetRight })
} else if (offsetLeft < 0) {
container.scrollBy({ left: offsetLeft })
}
})
const offsetLeft = tabRect.left - containerRect.left
const offsetRight = tabRect.right - containerRect.right
if (offsetRight > 0) {
container.scrollBy({ left: offsetRight })
} else if (offsetLeft < 0) {
container.scrollBy({ left: offsetLeft })
}
},
{ immediate: true }
)

View File

@@ -41,9 +41,7 @@ export const useNodeDragAndDrop = <T>(
if (!isDraggingValidFiles(e)) return false
const files = filterFiles(e.dataTransfer!.files)
onDrop(files).then((results) => {
if (!results?.length) return
})
void onDrop(files)
return true
}
}

View File

@@ -23,9 +23,7 @@ export const useNodePaste = <T>(
const paste = allow_batch ? filteredFiles : filteredFiles.slice(0, 1)
onPaste(paste).then((result) => {
if (!result) return
})
void onPaste(paste)
return true
}
}

View File

@@ -117,7 +117,7 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
workflowPacks: nodePacks,
startFetchWorkflowPacks: async () => {
await getWorkflowPacks() // Parse the packs from the workflow nodes
startFetch() // Fetch the packs infos from the registry
await startFetch() // Fetch the packs infos from the registry
},
filterWorkflowPack
}

View File

@@ -21,7 +21,7 @@ export const useCanvasDrop = (canvasRef: Ref<HTMLCanvasElement>) => {
usePragmaticDroppable(() => canvasRef.value, {
getDropEffect: (args): Exclude<DataTransfer['dropEffect'], 'none'> =>
args.source.data.type === 'tree-explorer-node' ? 'copy' : 'move',
onDrop: (event) => {
onDrop: async (event) => {
const loc = event.location.current.input
const dndData = event.source.data
@@ -79,7 +79,7 @@ export const useCanvasDrop = (canvasRef: Ref<HTMLCanvasElement>) => {
loc.clientX,
loc.clientY
])
workflowService.insertWorkflow(workflow, { position })
await workflowService.insertWorkflow(workflow, { position })
}
}
}

View File

@@ -107,8 +107,8 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-download',
label: 'Export Workflow',
menubarLabel: 'Export',
function: () => {
workflowService.exportWorkflow('workflow', 'workflow')
function: async () => {
await workflowService.exportWorkflow('workflow', 'workflow')
}
},
{
@@ -116,8 +116,8 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-download',
label: 'Export Workflow (API Format)',
menubarLabel: 'Export (API)',
function: () => {
workflowService.exportWorkflow('workflow_api', 'output')
function: async () => {
await workflowService.exportWorkflow('workflow_api', 'output')
}
},
{
@@ -272,16 +272,19 @@ export function useCoreCommands(): ComfyCommand[] {
const settingStore = useSettingStore()
let lastLinksRenderMode = LiteGraph.SPLINE_LINK
return () => {
return async () => {
const currentMode = settingStore.get('Comfy.LinkRenderMode')
if (currentMode === LiteGraph.HIDDEN_LINK) {
// If links are hidden, restore the last positive value or default to spline mode
settingStore.set('Comfy.LinkRenderMode', lastLinksRenderMode)
await settingStore.set('Comfy.LinkRenderMode', lastLinksRenderMode)
} else {
// If links are visible, store the current mode and hide links
lastLinksRenderMode = currentMode
settingStore.set('Comfy.LinkRenderMode', LiteGraph.HIDDEN_LINK)
await settingStore.set(
'Comfy.LinkRenderMode',
LiteGraph.HIDDEN_LINK
)
}
}
})()
@@ -291,9 +294,9 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-play',
label: 'Queue Prompt',
versionAdded: '1.3.7',
function: () => {
function: async () => {
const batchCount = useQueueSettingsStore().batchCount
app.queuePrompt(0, batchCount)
await app.queuePrompt(0, batchCount)
}
},
{
@@ -301,9 +304,9 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-play',
label: 'Queue Prompt (Front)',
versionAdded: '1.3.7',
function: () => {
function: async () => {
const batchCount = useQueueSettingsStore().batchCount
app.queuePrompt(-1, batchCount)
await app.queuePrompt(-1, batchCount)
}
},
{
@@ -345,8 +348,8 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-step-forward',
label: 'Next Opened Workflow',
versionAdded: '1.3.9',
function: () => {
workflowService.loadNextOpenedWorkflow()
function: async () => {
await workflowService.loadNextOpenedWorkflow()
}
},
{
@@ -354,8 +357,8 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-step-backward',
label: 'Previous Opened Workflow',
versionAdded: '1.3.9',
function: () => {
workflowService.loadPreviousOpenedWorkflow()
function: async () => {
await workflowService.loadPreviousOpenedWorkflow()
}
},
{
@@ -438,15 +441,15 @@ export function useCoreCommands(): ComfyCommand[] {
let previousDarkTheme: string = DEFAULT_DARK_COLOR_PALETTE.id
let previousLightTheme: string = DEFAULT_LIGHT_COLOR_PALETTE.id
return () => {
return async () => {
const settingStore = useSettingStore()
const theme = colorPaletteStore.completedActivePalette
if (theme.light_theme) {
previousLightTheme = theme.id
settingStore.set('Comfy.ColorPalette', previousDarkTheme)
await settingStore.set('Comfy.ColorPalette', previousDarkTheme)
} else {
previousDarkTheme = theme.id
settingStore.set('Comfy.ColorPalette', previousLightTheme)
await settingStore.set('Comfy.ColorPalette', previousLightTheme)
}
}
})()
@@ -544,8 +547,8 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-clone',
label: 'Duplicate Current Workflow',
versionAdded: '1.6.15',
function: () => {
workflowService.duplicateWorkflow(workflowStore.activeWorkflow!)
function: async () => {
await workflowService.duplicateWorkflow(workflowStore.activeWorkflow!)
}
},
{
@@ -553,9 +556,9 @@ export function useCoreCommands(): ComfyCommand[] {
icon: 'pi pi-times',
label: 'Close Current Workflow',
versionAdded: '1.7.3',
function: () => {
function: async () => {
if (workflowStore.activeWorkflow)
workflowService.closeWorkflow(workflowStore.activeWorkflow)
await workflowService.closeWorkflow(workflowStore.activeWorkflow)
}
},
{

View File

@@ -55,7 +55,8 @@ export function useDownload(url: string, fileName?: string) {
// Try falling back to normal fetch if using Civitai API fails
whenever(civitaiErr, fetchFileSize, { once: true })
} else {
fetchFileSize()
// Fetch file size in the background
void fetchFileSize()
}
})

View File

@@ -44,7 +44,7 @@ export const useRefreshableSelection = () => {
if (!isRefreshable.value) return
if (isAllNodesSelected.value) {
commandStore.execute('Comfy.RefreshNodeDefinitions')
await commandStore.execute('Comfy.RefreshNodeDefinitions')
} else {
await Promise.all(refreshableWidgets.value.map((item) => item.refresh()))
}

View File

@@ -32,23 +32,23 @@ export const useServerLogs = (options: UseServerLogsOptions = {}) => {
}
}
const start = () => {
api.subscribeLogs(true)
const start = async () => {
await api.subscribeLogs(true)
stop = useEventListener(api, LOGS_MESSAGE_TYPE, handleLogMessage)
}
const stopListening = () => {
const stopListening = async () => {
stop?.()
stop = null
api.subscribeLogs(false)
await api.subscribeLogs(false)
}
if (immediate) {
start()
void start()
}
onUnmounted(() => {
stopListening()
onUnmounted(async () => {
await stopListening()
logs.value = []
})

View File

@@ -189,14 +189,18 @@ export function useRemoteWidget<
* @returns the most recent value of the widget.
*/
function getValue(onFulfilled?: () => void) {
fetchValue().then((data) => {
if (isFirstLoad()) onFirstLoad(data)
if (refreshQueued && data !== defaultValue) {
onRefresh()
refreshQueued = false
}
onFulfilled?.()
})
void fetchValue()
.then((data) => {
if (isFirstLoad()) onFirstLoad(data)
if (refreshQueued && data !== defaultValue) {
onRefresh()
refreshQueued = false
}
onFulfilled?.()
})
.catch((err) => {
console.error(err)
})
return getCachedValue() ?? defaultValue
}

View File

@@ -17,14 +17,15 @@ export function setupAutoQueueHandler() {
graphHasChanged = true
} else {
graphHasChanged = false
app.queuePrompt(0, queueSettingsStore.batchCount)
// Queue the prompt in the background
void app.queuePrompt(0, queueSettingsStore.batchCount)
internalCount++
}
}
})
queueCountStore.$subscribe(
() => {
async () => {
internalCount = queueCountStore.count
if (!internalCount && !app.lastExecutionError) {
if (
@@ -32,7 +33,7 @@ export function setupAutoQueueHandler() {
(queueSettingsStore.mode === 'change' && graphHasChanged)
) {
graphHasChanged = false
app.queuePrompt(0, queueSettingsStore.batchCount)
await app.queuePrompt(0, queueSettingsStore.batchCount)
}
}
},

View File

@@ -36,8 +36,8 @@ export const useColorPaletteService = () => {
throw new Error(`Invalid color palette against zod schema:\n${error}`)
}
const persistCustomColorPalettes = () => {
settingStore.set(
const persistCustomColorPalettes = async () => {
await settingStore.set(
'Comfy.CustomColorPalettes',
colorPaletteStore.customPalettes
)
@@ -48,9 +48,9 @@ export const useColorPaletteService = () => {
*
* @param colorPaletteId - The ID of the color palette to delete.
*/
const deleteCustomColorPalette = (colorPaletteId: string) => {
const deleteCustomColorPalette = async (colorPaletteId: string) => {
colorPaletteStore.deleteCustomPalette(colorPaletteId)
persistCustomColorPalettes()
await persistCustomColorPalettes()
}
/**
@@ -58,10 +58,10 @@ export const useColorPaletteService = () => {
*
* @param colorPalette - The palette to add.
*/
const addCustomColorPalette = (colorPalette: Palette) => {
const addCustomColorPalette = async (colorPalette: Palette) => {
validateColorPalette(colorPalette)
colorPaletteStore.addCustomPalette(colorPalette)
persistCustomColorPalettes()
await persistCustomColorPalettes()
}
/**
@@ -176,14 +176,16 @@ export const useColorPaletteService = () => {
const file = await uploadFile('application/json')
const text = await file.text()
const palette = JSON.parse(text)
addCustomColorPalette(palette)
await addCustomColorPalette(palette)
return palette
}
return {
getActiveColorPalette: () => colorPaletteStore.completedActivePalette,
addCustomColorPalette: wrapWithErrorHandling(addCustomColorPalette),
deleteCustomColorPalette: wrapWithErrorHandling(deleteCustomColorPalette),
addCustomColorPalette: wrapWithErrorHandlingAsync(addCustomColorPalette),
deleteCustomColorPalette: wrapWithErrorHandlingAsync(
deleteCustomColorPalette
),
loadColorPalette: wrapWithErrorHandlingAsync(loadColorPalette),
exportColorPalette: wrapWithErrorHandling(exportColorPalette),
importColorPalette: wrapWithErrorHandlingAsync(importColorPalette)

View File

@@ -65,7 +65,7 @@ export const useExtensionService = () => {
if (extension.getCustomWidgets) {
// TODO(huchenlei): We should deprecate the async return value of
// getCustomWidgets.
;(async () => {
void (async () => {
if (extension.getCustomWidgets) {
const widgets = await extension.getCustomWidgets(app)
useWidgetStore().registerCustomWidgets(widgets)

View File

@@ -79,7 +79,7 @@ export const useLitegraphService = () => {
this.#addOutputs(ComfyNode.nodeData.outputs)
this.#setInitialSize()
this.serialize_widgets = true
extensionService.invokeExtensionsAsync('nodeCreated', this)
void extensionService.invokeExtensionsAsync('nodeCreated', this)
}
/**

View File

@@ -122,12 +122,12 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
const loggedTask = async () => {
taskLogs.value.push({ taskName, logs: logs.value })
startListening()
await startListening()
return task()
}
const onComplete = () => {
stopListening()
const onComplete = async () => {
await stopListening()
setStale()
}

View File

@@ -30,15 +30,15 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
const isBookmarked = (node: ComfyNodeDefImpl) =>
bookmarksSet.value.has(node.nodePath) || bookmarksSet.value.has(node.name)
const toggleBookmark = (node: ComfyNodeDefImpl) => {
const toggleBookmark = async (node: ComfyNodeDefImpl) => {
if (isBookmarked(node)) {
deleteBookmark(node.nodePath)
await deleteBookmark(node.nodePath)
// Delete the bookmark at the top level if it exists
// This is used for clicking the bookmark button in the node library, i.e.
// the node is inside original/standard node library tree node
deleteBookmark(node.name)
await deleteBookmark(node.name)
} else {
addBookmark(node.name)
await addBookmark(node.name)
}
}
@@ -62,28 +62,28 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
return buildNodeDefTree(bookmarkNodes)
}
const addBookmark = (nodePath: string) => {
settingStore.set(BOOKMARK_SETTING_ID, [...bookmarks.value, nodePath])
const addBookmark = async (nodePath: string) => {
await settingStore.set(BOOKMARK_SETTING_ID, [...bookmarks.value, nodePath])
}
const deleteBookmark = (nodePath: string) => {
settingStore.set(
const deleteBookmark = async (nodePath: string) => {
await settingStore.set(
BOOKMARK_SETTING_ID,
bookmarks.value.filter((b: string) => b !== nodePath)
)
}
const addNewBookmarkFolder = (
const addNewBookmarkFolder = async (
parent: ComfyNodeDefImpl | undefined,
folderName: string
) => {
const parentPath = parent ? parent.nodePath : ''
const newFolderPath = parentPath + folderName + '/'
addBookmark(newFolderPath)
await addBookmark(newFolderPath)
return newFolderPath
}
const renameBookmarkFolder = (
const renameBookmarkFolder = async (
folderNode: ComfyNodeDefImpl,
newName: string
) => {
@@ -107,7 +107,7 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
throw new Error(`Folder name "${newNodePath}" already exists`)
}
settingStore.set(
await settingStore.set(
BOOKMARK_SETTING_ID,
bookmarks.value.map((b: string) =>
b.startsWith(folderNode.nodePath)
@@ -115,28 +115,28 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
: b
)
)
renameBookmarkCustomization(folderNode.nodePath, newNodePath)
await renameBookmarkCustomization(folderNode.nodePath, newNodePath)
}
const deleteBookmarkFolder = (folderNode: ComfyNodeDefImpl) => {
const deleteBookmarkFolder = async (folderNode: ComfyNodeDefImpl) => {
if (!folderNode.isDummyFolder) {
throw new Error('Cannot delete non-folder node')
}
settingStore.set(
await settingStore.set(
BOOKMARK_SETTING_ID,
bookmarks.value.filter(
(b: string) =>
b !== folderNode.nodePath && !b.startsWith(folderNode.nodePath)
)
)
deleteBookmarkCustomization(folderNode.nodePath)
await deleteBookmarkCustomization(folderNode.nodePath)
}
const bookmarksCustomization = computed<
Record<string, BookmarkCustomization>
>(() => settingStore.get('Comfy.NodeLibrary.BookmarksCustomization'))
const updateBookmarkCustomization = (
const updateBookmarkCustomization = async (
nodePath: string,
customization: BookmarkCustomization
) => {
@@ -153,23 +153,23 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
// If the customization is empty, remove it entirely
if (Object.keys(newCustomization).length === 0) {
deleteBookmarkCustomization(nodePath)
await deleteBookmarkCustomization(nodePath)
} else {
settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
await settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
...bookmarksCustomization.value,
[nodePath]: newCustomization
})
}
}
const deleteBookmarkCustomization = (nodePath: string) => {
settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
const deleteBookmarkCustomization = async (nodePath: string) => {
await settingStore.set('Comfy.NodeLibrary.BookmarksCustomization', {
...bookmarksCustomization.value,
[nodePath]: undefined
} as Record<string, BookmarkCustomization>)
}
const renameBookmarkCustomization = (
const renameBookmarkCustomization = async (
oldNodePath: string,
newNodePath: string
) => {
@@ -178,7 +178,7 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
updatedCustomization[newNodePath] = updatedCustomization[oldNodePath]
delete updatedCustomization[oldNodePath]
}
settingStore.set(
await settingStore.set(
'Comfy.NodeLibrary.BookmarksCustomization',
updatedCustomization
)

View File

@@ -378,8 +378,8 @@ export const useWorkflowStore = defineStore('workflow', () => {
// Update bookmarks
if (wasBookmarked) {
bookmarkStore.setBookmarked(oldPath, false)
bookmarkStore.setBookmarked(newPath, true)
await bookmarkStore.setBookmarked(oldPath, false)
await bookmarkStore.setBookmarked(newPath, true)
}
} finally {
isBusy.value = false
@@ -391,7 +391,7 @@ export const useWorkflowStore = defineStore('workflow', () => {
try {
await workflow.delete()
if (bookmarkStore.isBookmarked(workflow.path)) {
bookmarkStore.setBookmarked(workflow.path, false)
await bookmarkStore.setBookmarked(workflow.path, false)
}
delete workflowLookup.value[workflow.path]
} finally {
@@ -462,18 +462,18 @@ export const useWorkflowBookmarkStore = defineStore('workflowBookmark', () => {
})
}
const setBookmarked = (path: string, value: boolean) => {
const setBookmarked = async (path: string, value: boolean) => {
if (bookmarks.value.has(path) === value) return
if (value) {
bookmarks.value.add(path)
} else {
bookmarks.value.delete(path)
}
saveBookmarks()
await saveBookmarks()
}
const toggleBookmarked = (path: string) => {
setBookmarked(path, !bookmarks.value.has(path))
const toggleBookmarked = async (path: string) => {
await setBookmarked(path, !bookmarks.value.has(path))
}
return {

View File

@@ -114,7 +114,7 @@ export function fixBadLinks(
/**
* Internal patch node. We keep track of changes in patchedNodeSlots in case we're in a dry run.
*/
async function patchNodeSlot(
function patchNodeSlot(
node: ISerialisedNode | LGraphNode,
ioDir: IoDirection,
slot: number,

View File

@@ -51,9 +51,9 @@ const openGitDownloads = () => {
window.open('https://git-scm.com/downloads/', '_blank')
}
const skipGit = () => {
const skipGit = async () => {
console.warn('pushing')
const router = useRouter()
router.push('install')
await router.push('install')
}
</script>

View File

@@ -230,10 +230,12 @@ const onGraphReady = () => {
)
// Load model folders
wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)()
void wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)()
// Non-blocking load of node frequencies
wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)()
void wrapWithErrorHandlingAsync(
useNodeFrequencyStore().loadNodeFrequencies
)()
// Node defs now available after comfyApp.setup.
// Explicitly initialize nodeSearchService to avoid indexing delay when

View File

@@ -166,7 +166,7 @@ const noGpu = computed(() => typeof device.value !== 'string')
const electron = electronAPI()
const router = useRouter()
const install = () => {
const install = async () => {
const options: InstallOptions = {
installPath: installPath.value,
autoUpdate: autoUpdate.value,
@@ -183,7 +183,7 @@ const install = () => {
const nextPage =
options.device === 'unsupported' ? '/manual-configuration' : '/server-start'
router.push(nextPage)
await router.push(nextPage)
}
onMounted(async () => {

View File

@@ -78,6 +78,6 @@ const updateConsent = async () => {
} finally {
isUpdating.value = false
}
router.push('/')
await router.push('/')
}
</script>

View File

@@ -73,8 +73,8 @@ const reportIssue = () => {
}
const router = useRouter()
const continueToInstall = () => {
router.push('/install')
const continueToInstall = async () => {
await router.push('/install')
}
</script>

View File

@@ -76,8 +76,8 @@ const login = async () => {
throw new Error('No user selected')
}
userStore.login(user)
router.push('/')
await userStore.login(user)
await router.push('/')
} catch (err) {
loginError.value = err instanceof Error ? err.message : JSON.stringify(err)
}

View File

@@ -27,8 +27,8 @@ import { useRouter } from 'vue-router'
import BaseViewTemplate from '@/views/templates/BaseViewTemplate.vue'
const router = useRouter()
const navigateTo = (path: string) => {
router.push(path)
const navigateTo = async (path: string) => {
await router.push(path)
}
</script>

View File

@@ -38,27 +38,27 @@ describe('useServerLogs', () => {
expect(api.subscribeLogs).toHaveBeenCalledWith(true)
})
it('should start listening when startListening is called', () => {
it('should start listening when startListening is called', async () => {
const { startListening } = useServerLogs()
startListening()
await startListening()
expect(api.subscribeLogs).toHaveBeenCalledWith(true)
})
it('should stop listening when stopListening is called', () => {
it('should stop listening when stopListening is called', async () => {
const { startListening, stopListening } = useServerLogs()
startListening()
stopListening()
await startListening()
await stopListening()
expect(api.subscribeLogs).toHaveBeenCalledWith(false)
})
it('should register event listener when starting', () => {
it('should register event listener when starting', async () => {
const { startListening } = useServerLogs()
startListening()
await startListening()
expect(vi.mocked(useEventListener)).toHaveBeenCalledWith(
api,
@@ -69,7 +69,8 @@ describe('useServerLogs', () => {
it('should handle log messages correctly', async () => {
const { logs, startListening } = useServerLogs()
startListening()
await startListening()
// Get the callback that was registered with useEventListener
const eventCallback = vi.mocked(useEventListener).mock.calls[0][2] as (
@@ -94,7 +95,8 @@ describe('useServerLogs', () => {
const { logs, startListening } = useServerLogs({
messageFilter: (msg) => msg !== 'remove me'
})
startListening()
await startListening()
const eventCallback = vi.mocked(useEventListener).mock.calls[0][2] as (
event: CustomEvent<LogsWsMessage>