[TS] Fix ts-strict errors in Vue components (Part 3) (#3126)

This commit is contained in:
Chenlei Hu
2025-03-18 11:38:43 -04:00
committed by GitHub
parent a85a1bf794
commit 96ff8a7785
18 changed files with 56 additions and 40 deletions

View File

@@ -90,7 +90,7 @@ const { isReady } = useAsyncState(
null
)
const selectedTab = ref<WorkflowTemplates | null>()
const selectedTab = ref<WorkflowTemplates | null>(null)
const selectFirstTab = () => {
const firstTab = workflowTemplatesStore.groupedTemplates[0].modules[0]
handleTabSelection(firstTab)
@@ -118,7 +118,7 @@ const loadWorkflow = async (id: string) => {
workflowLoading.value = id
let json
if (selectedTab.value.moduleName === 'default') {
if (selectedTab.value?.moduleName === 'default') {
// Default templates provided by frontend are served on this separate endpoint
json = await fetch(api.fileURL(`/templates/${id}.json`)).then((r) =>
r.json()
@@ -126,13 +126,13 @@ const loadWorkflow = async (id: string) => {
} else {
json = await fetch(
api.apiURL(
`/workflow_templates/${selectedTab.value.moduleName}/${id}.json`
`/workflow_templates/${selectedTab.value?.moduleName}/${id}.json`
)
).then((r) => r.json())
}
useDialogStore().closeDialog()
const workflowName =
selectedTab.value.moduleName === 'default'
selectedTab.value?.moduleName === 'default'
? t(`templateWorkflows.template.${id}`, id)
: id
await app.loadGraphData(json, true, true, workflowName)