mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 21:54:50 +00:00
fix(templates): address code review findings
- Derive mediaType/mediaSubtype from thumbnail_type (video support) - Accept localized title in adaptHubWorkflowsToCategories instead of hardcoded 'All' - URL loader: resolve template by name or shareId before loading instead of retrying on every failure - Guard listAllHubWorkflows against cursor pagination loops
This commit is contained in:
@@ -110,23 +110,25 @@ export function useTemplateUrlLoader() {
|
||||
try {
|
||||
await templateWorkflows.loadTemplates()
|
||||
|
||||
let success = await templateWorkflows.loadWorkflowTemplate(
|
||||
templateParam,
|
||||
sourceParam
|
||||
)
|
||||
|
||||
// On cloud, if name-based lookup fails, try by shareId (hub templates)
|
||||
if (!success && isCloud) {
|
||||
// On cloud, resolve by name or shareId before attempting to load
|
||||
let resolvedName = templateParam
|
||||
let resolvedSource = sourceParam
|
||||
if (isCloud) {
|
||||
const store = useWorkflowTemplatesStore()
|
||||
const templateByShareId = store.getTemplateByShareId(templateParam)
|
||||
if (templateByShareId) {
|
||||
success = await templateWorkflows.loadWorkflowTemplate(
|
||||
templateByShareId.name,
|
||||
templateByShareId.sourceModule
|
||||
)
|
||||
const resolved =
|
||||
store.getTemplateByName(templateParam) ??
|
||||
store.getTemplateByShareId(templateParam)
|
||||
if (resolved) {
|
||||
resolvedName = resolved.name
|
||||
resolvedSource = resolved.sourceModule
|
||||
}
|
||||
}
|
||||
|
||||
const success = await templateWorkflows.loadWorkflowTemplate(
|
||||
resolvedName,
|
||||
resolvedSource
|
||||
)
|
||||
|
||||
if (!success) {
|
||||
toast.add({
|
||||
severity: 'error',
|
||||
|
||||
Reference in New Issue
Block a user