Skip to content

Commit

Permalink
Wrap each init task with error handling (#2187)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Jan 7, 2025
1 parent ea6c9e7 commit 07000a2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/views/GraphView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import GlobalToast from '@/components/toast/GlobalToast.vue'
import TopMenubar from '@/components/topbar/TopMenubar.vue'
import { SERVER_CONFIG_ITEMS } from '@/constants/serverConfig'
import { useCoreCommands } from '@/hooks/coreCommandHooks'
import { useErrorHandling } from '@/hooks/errorHooks'
import { i18n } from '@/i18n'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
Expand Down Expand Up @@ -162,29 +163,30 @@ onBeforeUnmount(() => {
useEventListener(window, 'keydown', useKeybindingService().keybindHandler)
const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling()
const onGraphReady = () => {
requestIdleCallback(
() => {
// Setting values now available after comfyApp.setup.
// Load keybindings.
useKeybindingService().registerUserKeybindings()
wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)()
// Load server config
useServerConfigStore().loadServerConfig(
wrapWithErrorHandling(useServerConfigStore().loadServerConfig)(
SERVER_CONFIG_ITEMS,
settingStore.get('Comfy.Server.ServerConfigValues')
)
// Load model folders
useModelStore().loadModelFolders()
wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)()
// Non-blocking load of node frequencies
wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)()
// Node defs now available after comfyApp.setup.
// Explicitly initialize nodeSearchService to avoid indexing delay when
// node search is triggered
useNodeDefStore().nodeSearchService.endsWithFilterStartSequence('')
// Non-blocking load of node frequencies
useNodeFrequencyStore().loadNodeFrequencies()
},
{ timeout: 1000 }
)
Expand Down

0 comments on commit 07000a2

Please sign in to comment.