load template workflow via URL query param (#6546)

## Summary

Adds support for loading templates via URL query parameters. Users can
now share direct links to templates.

To test:

1. checkout this branch
2. start dev server on port 5173
3. go to http://localhost:5173/?template=image_qwen_image_edit_2509

**Examples:**
- `/?template=default` - Loads template with default source
- `/?template=flux_simple&source=custom` - Loads from custom source

Includes error handling with toast notifications for invalid templates
and comprehensive test coverage.

---------

Co-authored-by: Christian Byrne <c.byrne@comfy.org>
This commit is contained in:
Christian Byrne
2025-11-02 21:23:56 -08:00
committed by GitHub
parent 4810b5728a
commit 9cd7a39f09
5 changed files with 326 additions and 6 deletions

View File

@@ -53,6 +53,7 @@ import { useSettingStore } from '@/platform/settings/settingStore'
import { useTelemetry } from '@/platform/telemetry'
import { useFrontendVersionMismatchWarning } from '@/platform/updates/common/useFrontendVersionMismatchWarning'
import { useVersionCompatibilityStore } from '@/platform/updates/common/versionCompatibilityStore'
import { useTemplateUrlLoader } from '@/platform/workflow/templates/composables/useTemplateUrlLoader'
import type { StatusWsMessageStatus } from '@/schemas/apiSchema'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
@@ -80,6 +81,9 @@ setupAutoQueueHandler()
useProgressFavicon()
useBrowserTabTitle()
// Template URL loading
const { loadTemplateFromUrl } = useTemplateUrlLoader()
const { t } = useI18n()
const toast = useToast()
const settingStore = useSettingStore()
@@ -349,6 +353,9 @@ const onGraphReady = () => {
tabCountChannel.postMessage({ type: 'heartbeat', tabId: currentTabId })
}
// Load template from URL if present
void loadTemplateFromUrl()
// Setting values now available after comfyApp.setup.
// Load keybindings.
wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)()