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:
dante01yoon
2026-03-28 23:01:03 +09:00
parent b48ed9bc1b
commit 0f7b3b38b0
4 changed files with 46 additions and 18 deletions

View File

@@ -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',